2013-01-10 67 views
2

此功能的jQuery,滚动股利(名为“搜索”的CSS),当用户滚动页面..滚动一个div时滚动页面

$(window).scroll(function(){ 
    $.each($('.Search'),function(){ 
     var windowpos = $(window).scrollTop(); 
     var finaldestination = windowpos+90; 
     $(this).stop().animate({'top':finaldestination},300); 
    }); 
}); 

此功能的jQuery不上网工作Explorer 9. 我试图做一个包含属性位置的CSS:固定但在Internet Explorer 9中不起作用。 有一种解决方案,允许我在用户在Internet Explorer中滚动页面时滚动div。 对于基础英语我很抱歉

+2

“位置:固定”在IE9中不起作用的唯一原因是,页面以怪癖模式呈现时,只有当您的HTML无效时 –

回答

0

在IE中可以正常工作。我用搜索的CSS是

.search { 
    position: absolute; 
    top: 90px; 
} 

Working Demo

编辑

要获得更快的动画过渡,清除队列。

.stop(true) 
2

只能使用CSS ...

.search { 
    width: 200px; 
    height: 50px; 
    background-color: red; 
    position: fixed; 
    top: 90px; 
} 

Example

问候。