滚动页面时滚动Div [英] Scroll a Div when Scroll the page

查看:79
本文介绍了滚动页面时滚动Div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

这个函数jQuery在Internet Explorer 9中不起作用。
我试图做一个包含属性位置的CSS:已修复,但在Internet Explorer 9中不起作用。
当用户在Internet Explorer中滚动页面时,有一种解决方案可以让我滚动div。
我为基础英语道歉

解决方案

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

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

工作演示



编辑

<


$ b

  .stop(true)
对于更快的动画转换,清除队列。 c>


This function jquery, scroll a div (with the css named "Search") when the user scroll the page..

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

This function jquery doesn't work in Internet Explorer 9. I tried to do a css that contain the attribute position:fixed but this doesn't work in Internet Explorer 9. There is a solution that allows me to scroll a div when the user scrolls the page in Internet Explorer? I apologize for the basic English

解决方案

Works fine in IE. The CSS I used for search is

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

Working Demo

Edit

For a faster animation transition, clear the queue.

.stop(true)

这篇关于滚动页面时滚动Div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆