/* */ $.fn.navfixed = function() { var navfix = function(element) { var top = element.position().top, pos = element.css("position"); $(window).scroll(function() { var scrolls = $(this).scrollTop(); if (scrolls > top) { if (window.XMLHttpRequest) { element.css({ position: "fixed", top: 0, right: 0, left: 0, zIndex: "9999", backgroundColor:"#ECECEC" }); } else { element.css({ top: scrolls }); } } else { element.css({ position: pos, top: top, backgroundColor:"#ffffff" }); } }); }; return $(this).each(function() { navfix($(this)); }); }; $.fn.smartFloat = function() { var position = function(element) { var top = element.position().top, pos = element.css("position"); $(window).scroll(function() { var scrolls = $(this).scrollTop(); if (scrolls > top) { if (window.XMLHttpRequest) { element.css({ position: "fixed", top: 100 }); } else { element.css({ top: scrolls }); } } else { element.css({ position: pos, top: top }); } }); }; return $(this).each(function() { position($(this)); }); }; //缁戝畾 if ($(window).width() > 1000) { $("#rnav").navfixed(); $("#rightTool").smartFloat(); }