锘?/瀵艰埅涓嬫媺寮€濮
$(document).ready(function(){
$('ul.navigationlist li').mousemove(function(){
$(this).find('ul').slideDown(280);//you can give it a speed
});
$('ul.navigationlist li').mouseleave(function(){
$(this).find('ul').slideUp(280);
});
$("#logo_main").scrollFix({zIndex:1000});
});
//瀵艰埅涓嬫媺缁撴潫
/*====scrool鎻掍欢 寮€濮婟===*/
;(function($) {
$.fn.scrollFix = function(options) {
return this.each(function() {
var opts = $.extend({}, $.fn.scrollFix.defaultOptions, options);
var obj = $(this),
base = this,
selfTop = 0,
selfLeft = 0,
toTop = 0,
parentOffsetLeft = 0,
parentOffsetTop = 0,
outerHeight,
outerWidth,
objWidth = 0,
placeholder = jQuery('
'), //鍒涘缓涓€涓猨query瀵硅薄
optsTop = opts.distanceTop, //瀹氫箟鍒伴《閮ㄧ殑楂樺害
endfix = 0; //寮€濮嬪仠姝㈠浐瀹氱殑浣嶇疆
var originalPosition;
var originalOffsetTop;
var originalZIndex;
var lastOffsetLeft = -1;
var isUnfixed = true;
//濡傛灉娌℃湁鎵惧埌鑺傜偣锛屼笉杩涜澶勭悊
if (obj.length <= 0) {
return;
}
if (lastOffsetLeft == -1) {
originalZIndex = obj.css('z-index');
position = obj.css('position');
originalPosition = obj.css('position');
originalOffsetTop = obj.css('top');
}
var zIndex = obj.css('zIndex');
if (opts.zIndex != 0) {
zIndex = opts.zIndex;
}
//鑾峰彇鐩稿瀹氫綅鎴栬€呯粷瀵瑰畾浣嶇殑鐖剁被
var parents = obj.parent();
var Position = parents.css('position');
while (!/^relative|absolute$/i.test(Position)) { //妫€娴嬫诞鍔ㄥ厓绱犵殑鐖剁被鍏冪礌瀹氫綅涓?relative'鎴栬€?absolute',鏄殑璇濋€€鍑猴紝鍚﹀垯鐨勮瘽锛屾墽琛屽惊鐜紝缁х画瀵绘壘瀹冪殑鐖剁被
parents = parents.parent();
Position = parents.css('position');
if (/^body|html$/i.test(parents[0].tagName)) break; //鍋囧鐖剁被鍏冪礌鐨勬爣绛句负body鎴栬€匟TML锛岃鏄庢病鏈夋壘鍒扮埗绫讳负浠ヤ笂鐨勫畾浣嶏紝閫€鍑哄惊鐜
}
var ie6 = !-[1, ] && !window.XMLHttpRequest; //鍏煎IE6
var resizeWindow = false;
function resetScroll() {
setUnfixed();
selfTop = obj.offset().top; //瀵硅薄璺濈椤堕儴楂樺害
selfLeft = obj.offset().left; //瀵硅薄璺濈宸﹁竟瀹藉害
outerHeight = obj.outerHeight(); //瀵硅薄楂樺害
outerHeight = parseFloat(outerHeight) + parseFloat(obj.css('marginBottom').replace(/auto/, 0));
outerWidth = obj.outerWidth(); //瀵硅薄澶栧搴
objWidth = obj.width();
var documentHeight = $(document).height(); //鏂囨。楂樺害
var startTop = $(opts.startTop), //寮€濮嬫诞鍔ㄥ浐瀹氬璞
startBottom = $(opts.startBottom),
toBottom, //鍋滄婊氬姩浣嶇疆璺濈搴曢儴鐨勯珮搴
ScrollHeight; //瀵硅薄婊氬姩鐨勯珮搴
//璁$畻鐖剁被鍋忕Щ鍊
if (/^body|html$/i.test(parents[0].tagName)) { //褰撶埗绫诲厓绱犻潪body鎴栬€匟TML鏃讹紝璇存槑鎵惧埌浜嗕竴涓埗绫讳负'relative'鎴栬€?absolute'鐨勫厓绱狅紝寰楀嚭瀹冪殑鍋忕Щ楂樺害
parentOffsetTop = 0, parentOffsetLeft = 0;
} else {
parentOffsetLeft = parents.offset().left, parentOffsetTop = parents.offset().top;
}
// 璁$畻鐖惰妭鐐圭殑涓婅竟鍒伴《閮ㄨ窛绂
// 濡傛灉 body 鏈 top 灞炴€? 娑堥櫎杩欎簺浣嶇Щ
var bodyToTop = parseInt(jQuery('body').css('top'), 10);
if (!isNaN(bodyToTop)) {
optsTop += bodyToTop;
}
//璁$畻鍋滃湪搴曢儴鐨勮窛绂
if (!isNaN(opts.endPos)) {
toBottom = opts.endPos;
} else {
toBottom = parseFloat(documentHeight - $(opts.endPos).offset().top);
}
//璁$畻闇€瑕佹粴鍔ㄧ殑楂樺害浠ュ強鍋滄婊氬姩鐨勯珮搴
ScrollHeight = parseFloat(documentHeight - toBottom - optsTop), endfix = parseFloat(ScrollHeight - outerHeight);
//璁$畻椤堕儴鐨勮窛绂诲€
if (startTop[0]) {
var startTopOffset = startTop.offset(),
startTopPos = startTopOffset.top;
selfTop = startTopPos;
}
if (startBottom[0]) {
var startBottomOffset = startBottom.offset(),
startBottomPos = startBottomOffset.top,
startBottomHeight = startBottom.outerHeight();
selfTop = parseFloat(startBottomPos + startBottomHeight);
}
toTop = selfTop - optsTop;
toTop = (toTop > 0) ? toTop : 0;
var selfBottom = documentHeight - selfTop - outerHeight;
//濡傛灉婊氬姩鍋滃湪搴曢儴鐨勫€间笉涓?锛屽苟涓旇嚜韬埌搴曢儴鐨勯珮搴﹀皬浜庝笂闈㈣繖涓€硷紝涓嶆墽琛屾诞鍔ㄥ浐瀹
if ((toBottom != 0) && (selfBottom <= toBottom)) {
return;
}
}
function setUnfixed() {
if (!isUnfixed) {
lastOffsetLeft = -1;
placeholder.css("display", "none");
obj.css({
'z-index': originalZIndex,
'width': '',
'position': originalPosition,
'left': '',
'top': originalOffsetTop,
'margin-left': ''
});
obj.removeClass('scrollfixed');
isUnfixed = true;
}
}
function onScroll() {
lastOffsetLeft = 1;
var ScrollTop = $(window).scrollTop();
if (opts.bottom != -1) {
ScrollTop = ScrollTop + $(window).height() - outerHeight - opts.bottom;
}
if (ScrollTop > toTop && (ScrollTop < endfix)) {
if (ie6) { //IE6鍒欎娇鐢ㄨ繖涓牱寮
obj.addClass(opts.baseClassName).css({
"z-index": zIndex,
"position": "absolute",
"top": opts.bottom == -1 ? ScrollTop + optsTop - parentOffsetTop : ScrollTop - parentOffsetTop,
"bottom": 'auto',
"left": selfLeft - parentOffsetLeft,
'width': objWidth
})
} else {
obj.addClass(opts.baseClassName).css({
"z-index": zIndex,
"position": "fixed",
"top": opts.bottom == -1 ? optsTop : '',
"bottom": opts.bottom == -1 ? '' : opts.bottom,
"left": selfLeft,
"width": objWidth
});
}
placeholder.css({
'height': outerHeight,
'width': outerWidth,
'display': 'block'
}).insertBefore(obj);
} else if (ScrollTop >= endfix) {
obj.addClass(opts.baseClassName).css({
"z-index": zIndex,
"position": "absolute",
"top": endfix - parentOffsetTop + optsTop,
'bottom': '',
"left": selfLeft - parentOffsetLeft,
"width": objWidth
});
placeholder.css({
'height': outerHeight,
'width': outerWidth,
'display': 'block'
}).insertBefore(obj)
} else {
obj.removeClass(opts.baseClassName).css({
"z-index": originalZIndex,
"position": "static",
"top": "",
"bottom": "",
"left": ""
});
placeholder.remove()
}
}
var Timer = 0;
// if (isUnfixed) {
resetScroll();
// }
$(window).on("scroll", function() {
if (Timer) {
clearTimeout(Timer);
}
Timer = setTimeout(onScroll, 0);
});
// 褰撳彂鐜拌皟鏁村睆骞曞ぇ灏忔椂锛岄噸鏂版墽琛屼唬鐮
$(window).on("resize", function() {
if (Timer) {
clearTimeout(Timer);
}
Timer = setTimeout(function() {
isUnfixed = false;
resetScroll();
onScroll();
}, 0);
});
})
}
$.fn.scrollFix.defaultOptions = {
startTop: null, //婊戝埌杩欎釜浣嶇疆椤堕儴鏃跺紑濮嬫诞鍔紝榛樿涓虹┖
startBottom: null, //婊戝埌杩欎釜浣嶇疆鏈寮€濮嬫诞鍔紝榛樿涓虹┖
distanceTop: 0, //鍥哄畾鍦ㄩ《閮ㄧ殑楂樺害
endPos: 0, //鍋滈潬鍦ㄥ簳閮ㄧ殑浣嶇疆锛屽彲浠ヤ负jquery瀵硅薄
bottom: -1, //搴曢儴浣嶇疆
zIndex: 0, //z-index鍊
baseClassName: 'scrollfixed' //寮€濮嬪浐瀹氭椂娣诲姞鐨勭被
};
})(jQuery);
/*====scrool鎻掍欢 缁撴潫====*/
/*==! Lazy Load 1.9.1 - MIT license - Copyright 2010-2013 Mika Tuupola ==*/
!function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!0,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("
").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document);
/*==Lazy Load 1.9.1 缁撴潫==*/