jQuery scrolltop firefox not working

前端 未结 2 1130
鱼传尺愫
鱼传尺愫 2020-11-27 08:09

This script:

function onscroll(){
    document.getElementById(\"divs\").style.top=\"\"+$(\'body\').scrollTop()+\"px\";
}

Fiddle: http://jsf

2条回答
  •  执念已碎
    2020-11-27 08:55

    Try this fiddle, it is working in chrome, ie and the latest version of mozilla : http://jsfiddle.net/Hed2J/3/

    I replace $('body').scrollTop() with $(window).scrollTop().

提交回复
热议问题