내 생각을 잃어 가고 있습니다. 이것은 단순한 것으로 가정하고 jQuery 멍청한 것처럼 복잡하게 만듭니다. 한숨.탭 ('select', #) 뒤에 scrollTo() 스크롤하지 않습니다.
그래서이 페이지는 # switchto = aC# goto = acemergency 해시 태그를 사용하고 jQuery 탭을 적절히 전환 한 다음 원하는 ID로 이동 (스크롤)해야합니다. 문제는 tabs()가 자동으로 컨테이너의 맨 위로 스크롤하고 scrollTo()가 호출 될 때 더 이상 스크롤 할 곳을 알지 못한다는 것입니다. 다른 말로하면 스크롤하지 않습니다. 여기
jQuery(window).hashchange(function(e) {
if (window.location.hash) {
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
var instruct = hash.split('#'); //split instructions
var whichtab = instruct[0].split('='); // split instruction from tab name
try {
var whichid = instruct[1].split('='); // split instruction from id name
}
catch (err) { /*suppress*/
}
if (whichtab[0] == "switchto") {
switch (whichtab[1]) {
case 'ac':
try {
if (whichid[1] != "") {
$s.when(targettab(0)).then(targetid(whichid[1]));
}
} catch (err) {}
$s('.tour').tabs('select', 0);
break;
case 'heating':
try {
if (whichid[1] != "") {
$s.when(targettab(1)).then(targetid(whichid[1]));
}
} catch (err) {}
$s('.tour').tabs('select', 1);
break;
case 'plumbing':
try {
if (whichid[1] != "") {
$s.when(targettab(2)).then(targetid(whichid[1]));
}
} catch (err) {}
$s('.tour').tabs('select', 2);
break;
}
}
}
});
그리고는 내 기능 : 나는 여러 가지 방법을 시도
function targetid(givenid) {
//$s('html,body').animate({scrollTop: $s("#"+givenid).offset().top},'fast');
$s.scrollTo($s("#" + givenid), 400);
$s("#" + givenid).delay(500).fadeTo('slow', 0.1, function() {
$s("#" + givenid).fadeTo('slow', 1);
console.log('got ' + givenid + ' and scrolled to it');
});
}
function targettab(giventab) {
$s('.tour').tabs('select', giventab);
}
내가 여기에 유래에 발견했지만 그들 중 누구도 내 문제를 해결하기 위해 보인다
여기 내 이벤트 핸들러입니다. 어떤 아이디어? tabs()가 tabsselect에서 위로 스크롤하지 못하도록하는 방법이 있습니까?