Home >Web Front-end >JS Tutorial >jQuery implements pulling the page to fix the top display and disappear automatically (Firefox)_Page background

jQuery implements pulling the page to fix the top display and disappear automatically (Firefox)_Page background

WBOY
WBOYOriginal
2016-05-16 17:45:26915browse

[Ctrl A select all Note:
If you need to introduce external Js, you need to refresh to execute ]<script> $(function () { $(".Xc_list_top").css("width",$(".Xc_list_main").width()); var resetRightPanelPostion = function () { var msie6 = $.browser.msie && $.browser.version == '6.0' && $.browser.version < 7; if ($.browser.safari) { bodyelem = $("body"); } else { bodyelem = $("html,body"); } var bodyTop = bodyelem.scrollTop(); var top = $(".Xc_left").offset().top; //var t = $("#public_footer").offset().top; var t = $("#footerDestinationBox").offset().top; //var bottom = $("#footerDestinationBox").offset().top; for(var i = 0 ; i < $(".Xc_list .Xc_list_top").length ; i++){ if (bodyTop >= top && ((bodyTop + $(".Xc_left").outerHeight()) < t)) { if (!msie6) { if (bodyTop + $(".Xc_gg").outerHeight() >= t) { $(".Xc_gg").removeClass('fixed').css({ "position": "absolute", "top": t - $(".Xc_gg").outerHeight() + "px" }); } else { $(".Xc_gg").css({ "position": "fixed", "top": 0 }); } } } else { if (!msie6) { $(".Xc_gg").css({ "position": "static" }); } } if(bodyTop>$(".Xc_list").eq(i).offset().top){ $(".Xc_list_top").eq(i).css({position:"absolute",top:top-168}); } if(bodyTop>$(".Xc_list").eq(i).offset().top){ $(".Xc_list_top").eq(i).css({position:"fixed",top:0}); } if(bodyTop<=$(".Xc_list").eq(i).offset().top){ $(".Xc_list_top").eq(i).css({position:"static",top:0}); } } }; window.onload = function () { if ($(".Xc_gg").length) { resetRightPanelPostion(); $(window).scroll(function () { resetRightPanelPostion(); }); } } }) </script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn