/* * jsort - jqury sorting plugin * http://do-web.com/jsort/overview * * copyright 2011, miriam zusin * dual licensed under the mit or gpl version 2 licenses. * http://do-web.com/jsort/license */ (function($){ htmlslideplayer = function(object,config){ this.obj = object; this.n =0; this.j =0; this.first_show = 1; var _this = this; var _obj = this.obj; var t; var defaults = {fontsize:12,right:10,bottom:15,time:5000,autosize:0,slidearrow:false}; this.config = $.extend(defaults,config); this.count = $(_obj + " li").length; this.factory = function(){ //元素定位 $(_obj).css({position:"relative",zindex:"0",overflow:"hidden", height: $(_obj + " ul").height() + "px" }); $(_obj).prepend("
"); $(_obj + " ul").css({position:"relative",zindex:"0",margin:"0",padding:"0",overflow:"hidden", width:"100%" }) $(_obj + " li").css({position:"absolute",top:"0",left:"0",width:"100%",height: "100%" ,overflow:"hidden"}).hide().each(function(i){ $(_obj + " .slide_control").append(""+(i+1)+""); }); this.resetclass(_obj + " .slide_control a",0); //第一张图片lazyload var img =$(_obj + " li").first().find('img'); if ( img.length > 0 && !!img.attr('lazyload') ){ $.each(img,function(i){ $(this).attr("src",$(this).attr("lazyload")).removeattr("lazyload"); }); } this.slide(); this.slidearrow(); t = setinterval(this.autoplay,this.config.time); //force the first slide to show $(_obj + " .slide_control a").eq(0).triggerhandler('mouseover'); }; //加一个上一页下一页的按钮 this.slidearrow = function(){ if(this.config.slidearrow){ var prev_button = $('<'); var next_button = $('>'); $(_obj).append(prev_button).append(next_button); next_button.bind('click',function(){ if(_this.n == _this.count-1){ $(_obj + " .slide_control a").eq(0).triggerhandler('mouseover'); }else{ $(_obj + " .slide_control a").eq(_this.n+1).triggerhandler('mouseover'); } }); prev_button.bind('click',function(){ if(_this.n == 0){ $(_obj + " .slide_control a").eq(_this.count-1).triggerhandler('mouseover'); }else{ $(_obj + " .slide_control a").eq(_this.n-1).triggerhandler('mouseover'); } }); } } //图片渐影 this.slide = function(){ $(_obj + " .slide_control a").lazyhover(function(){ _this.j = $(this).text() - 1; _this.n = _this.j; if (_this.j >= _this.count){return;} //防止闪一下 if(_this.first_show) { _this.first_show = 0; $(_obj + " li:eq(" + _this.j + ")").show().siblings("li").hide(); }else { var li =$(_obj + " li:eq(" + _this.j + ")"); var next_li ; if ( _this.count >= _this.j + 1 ){ next_li = $(_obj + " li:eq(" + (_this.j+1) + ")"); } li.fadein("200").siblings("li").fadeout("200"); //添加图片延迟加载 var img=$("img[lazyload]",li); $.each(img,function(i){ $(this).attr("src",$(this).attr("lazyload")).removeattr("lazyload"); }); //背景图延迟加载 var bg_src = li.attr("lazyload"); if(bg_src!=undefined){ li.css('background-image','url('+bg_src+')').removeattr("lazyload"); if ( next_li != undefined && next_li.length >= 1 ){ var next_bg_src = next_li.attr("lazyload"); if ( next_bg_src != undefined ){ next_li.css('background-image','url('+next_bg_src+')').removeattr("lazyload"); } } } }; _this.resetclass(_obj + " .slide_control a",_this.j); },200,500); }; //滑过停止 $(_obj)[0].onmouseover=function(){ clearinterval(t); }; $(_obj)[0].onmouseout=function(){ t = setinterval(_this.autoplay,_this.config.time) }; //自动播放 this.autoplay = function(){ _this.n = _this.n >= (_this.count - 1) ? 0 : ++_this.n; $(_obj + " .slide_control a").eq(_this.n).triggerhandler('mouseover'); } //翻页函数 this.resetclass =function(obj,i){ $(obj).removeclass('mall_dot_hover').addclass('mall_dot'); $(obj).eq(i).addclass('mall_dot_hover'); if($.browser.msie && $.browser.version == 6.0){ $('.img_slider_trigger').css("zoom","1"); } }; this.factory(); } })(jquery); $(function(){ $.fn.lazyhover = function(fuc_on, de_on, de_out) { var self = $(this); var flag = 1; var h; var handle = function(elm){ cleartimeout(h); if(!flag) self.removedata('timer'); return flag ? fuc_on.apply(elm) : null; }; var time_on = de_on || 0; var time_out = de_out || 500; var timer = function(elm){ h && cleartimeout(h); h = settimeout(function() { handle(elm); }, flag ? time_on : time_out); self.data('timer', h); } self.hover( function(){ flag = 1 ; timer(this); }, function(){ flag = 0 ; timer(this); } ); } }); (function($) { $.fn.hoverlazy = function(option) { var s = $.extend({ current: "hover", delay: 20 }, option || {}); $.each(this, function() { var timer1 = null, timer2 = null, flag = false; $(this).bind("mouseover", function() { if (flag) { cleartimeout(timer2); } else { var _this = $(this); timer1 = settimeout(function() { _this.addclass(s.current); flag = true; }, s.delay); } }).bind("mouseout", function() { if (flag) { var _this = $(this); timer2 = settimeout(function() { _this.removeclass(s.current); flag = false; }, s.delay); } else { cleartimeout(timer1); } }) }) } })(jquery); $(function(){ var alinks=$("#banner_ad a"); alinks.each(function(){ var href=$(this).attr('href'); var src=$(this).children('img').attr('src'); var img=$('
  • ') $("#pre_banner_802 ul").append(img); }) }) $(function(){ var pre_banner = new htmlslideplayer("#pre_banner_802",{autosize:1,fontsize:12,time:3000}); })