最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery Scroll doesn't work in IE 7 and IE 8 - Stack Overflow

programmeradmin0浏览0评论

Here is an example of what I use:

jQuery(document).ready(function() {

    console.log('scroll');

    jQuery(window).scroll(function () {
        console.log('scrolling 1');
    });

    jQuery(document).scroll(function () {
        console.log('scrolling 2');
    });
});

This will only return "scroll in IE 7 and IE 8.
And in Chrome, Firefox and IE 9 it will return everything one time and "scrolling 2" whenever I'm scrolling.

I am also locked to jQuery 1.3

Does anyone have any idea how to get this working in IE 7 and IE 8?


Edit:
I have now found out that the reason of this seems to relate to a jQuery Lightbox Plugin.

Here is an example of what I use:

jQuery(document).ready(function() {

    console.log('scroll');

    jQuery(window).scroll(function () {
        console.log('scrolling 1');
    });

    jQuery(document).scroll(function () {
        console.log('scrolling 2');
    });
});

This will only return "scroll in IE 7 and IE 8.
And in Chrome, Firefox and IE 9 it will return everything one time and "scrolling 2" whenever I'm scrolling.

I am also locked to jQuery 1.3

Does anyone have any idea how to get this working in IE 7 and IE 8?


Edit:
I have now found out that the reason of this seems to relate to a jQuery Lightbox Plugin.

Share Improve this question edited Jan 5, 2012 at 10:31 Patrik asked Jan 4, 2012 at 10:46 PatrikPatrik 2,2573 gold badges30 silver badges50 bronze badges 2
  • As I recall you can give the body relative positioning or something like that to make it work. Sorry I don't have time to sort it for you! – mrtsherman Commented Jan 4, 2012 at 16:02
  • It seems like the problem is not the code it self but some other script that is interfering. – Patrik Commented Jan 4, 2012 at 18:18
Add a ment  | 

2 Answers 2

Reset to default 2

The issue was on row 817 in jquery.lightbox.js

$(window).unbind().resize(function ()

This will unbind everything connected to $(window) and not only resize.
So the solution is:

$(window).unbind('resize').resize(function ()

Check out the ScrollTo plug-in.

http://flesler.blogspot./2007/10/jqueryscrollto.html

Their demo page uses jQuery 1.3.2 -

http://demos.flesler./jquery/scrollTo/

Also note:

Doesn't scroll on IE. Sometimes, you need to set a position (relative or absolute) to the container and give it fixed dimensions, in order to hide the overflow. If this doesn't work, try giving the container fixed dimensions (height & width).

UPDATED Using jQuery 1.11.1, using jquery.scrollTo release 1.4.13 with the following:

$( '#parent' ).scrollTo( $( '#target' ), 800 );

This works on IE 7.0.5730.11.

发布评论

评论列表(0)

  1. 暂无评论