开发者

JQuery ScrollTop IE,Opera

开发者 https://www.devze.com 2023-02-08 06:55 出处:网络
I scroll browser screen to Div element by his ID. /* Scroll screen to Menu*/ if ($(\"#menu\").offset().top != 0) {

I scroll browser screen to Div element by his ID.

/* Scroll screen to Menu  */
if ($("#menu").offset().top != 0) {
    $("html,body").animate开发者_运维问答({ scrollTop: $("#menu").offset().top }, 1200);
} 

But in Opera and IE 7,8 , after i scroll it, the $("#menu").offset().top isn't 0, how i can fix it ? Now if i call again this script, screen scroll from same place. (in FireFox a Chrome is work fine)


Try this one if ($("#menu").offset().top != 0) { $("html,body").animate({ scrollTop: 0 }, 1200); }

I hope this will workout

0

精彩评论

暂无评论...
验证码 换一张
取 消