我的代码存在问题。悬停在选项卡上强制浏览器滚动到页面顶部
我用这个JS
$(document).ready(function() {
//Default Action
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab contentDocument
//On Hover Event
$("ul.tabs li").hover(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
return true;
});
});
当我将鼠标悬停在一个标签,内容变更,但浏览器滚动页面的顶端。 我想要 - 当我将鼠标悬停在标签上时,页面将保持当前的滚动位置,并且内容被更新。
非常感谢,我没有想到责怪CSS是:) – Avrae 2012-02-17 10:29:26