jquery(document).ready(function ($) { //根据窗口大小判断加载不同的尺寸的图片 function change(){ var w_width=$(window).width(); $('img').each(function() { if(w_width>1200){ $(this).attr('src',$(this).attr('data-1920')); } else if(w_width<=1200){ $(this).attr('src',$(this).attr('data-640')); } }) }change(); var _slideshowtransitions = [ //fade in l {$duration: 3100, x: 0.3, $during: { $left: [0.3, 0.7] }, $easing: { $left: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade out r , { $duration: 3100, x: -0.3, $slideout: true, $easing: { $left: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade in r , { $duration: 3100, x: -0.3, $during: { $left: [0.3, 0.7] }, $easing: { $left: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade out l , { $duration: 3100, x: 0.3, $slideout: true, $easing: { $left: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade in t , { $duration: 3100, y: 0.3, $during: { $top: [0.3, 0.7] }, $easing: { $top: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2, $outside: true } //fade out b , { $duration: 3100, y: -0.3, $slideout: true, $easing: { $top: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2, $outside: true } //fade in b , { $duration: 3100, y: -0.3, $during: { $top: [0.3, 0.7] }, $easing: { $top: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade out t , { $duration: 3100, y: 0.3, $slideout: true, $easing: { $top: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade in lr , { $duration: 3100, x: 0.3, $cols: 2, $during: { $left: [0.3, 0.7] }, $chessmode: { $column: 3 }, $easing: { $left: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2, $outside: true } //fade out lr , { $duration: 3100, x: 0.3, $cols: 2, $slideout: true, $chessmode: { $column: 3 }, $easing: { $left: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2, $outside: true } //fade in tb , { $duration: 3100, y: 0.3, $rows: 2, $during: { $top: [0.3, 0.7] }, $chessmode: { $row: 12 }, $easing: { $top: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade out tb , { $duration: 3100, y: 0.3, $rows: 2, $slideout: true, $chessmode: { $row: 12 }, $easing: { $top: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade in lr chess , { $duration: 3100, y: 0.3, $cols: 2, $during: { $top: [0.3, 0.7] }, $chessmode: { $column: 12 }, $easing: { $top: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2, $outside: true } //fade out lr chess , { $duration: 3100, y: -0.3, $cols: 2, $slideout: true, $chessmode: { $column: 12 }, $easing: { $top: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade in tb chess , { $duration: 3100, x: 0.3, $rows: 2, $during: { $left: [0.3, 0.7] }, $chessmode: { $row: 3 }, $easing: { $left: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2, $outside: true } //fade out tb chess , { $duration: 3100, x: -0.3, $rows: 2, $slideout: true, $chessmode: { $row: 3 }, $easing: { $left: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade in corners , { $duration: 3100, x: 0.3, y: 0.3, $cols: 2, $rows: 2, $during: { $left: [0.3, 0.7], $top: [0.3, 0.7] }, $chessmode: { $column: 3, $row: 12 }, $easing: { $left: $jssoreasing$.$easeincubic, $top: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2, $outside: true } //fade out corners , { $duration: 3100, x: 0.3, y: 0.3, $cols: 2, $rows: 2, $during: { $left: [0.3, 0.7], $top: [0.3, 0.7] }, $slideout: true, $chessmode: { $column: 3, $row: 12 }, $easing: { $left: $jssoreasing$.$easeincubic, $top: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2, $outside: true } //fade clip in h , { $duration: 3100, $delay: 20, $clip: 3, $assembly: 260, $easing: { $clip: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade clip out h , { $duration: 3100, $delay: 20, $clip: 3, $slideout: true, $assembly: 260, $easing: { $clip: $jssoreasing$.$easeoutcubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade clip in v , { $duration: 3100, $delay: 20, $clip: 12, $assembly: 260, $easing: { $clip: $jssoreasing$.$easeincubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } //fade clip out v , { $duration: 3100, $delay: 20, $clip: 12, $slideout: true, $assembly: 260, $easing: { $clip: $jssoreasing$.$easeoutcubic, $opacity: $jssoreasing$.$easelinear }, $opacity: 2 } ]; var options = { $autoplay: true, //[optional] whether to auto play, to enable slideshow, this option must be set to true, default value is false $autoplayinterval: 1500, //[optional] interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default value is 3000 $pauseonhover: 1, //[optional] whether to pause when mouse over if a slider is auto playing, 0 no pause, 1 pause for desktop, 2 pause for touch device, 3 pause for desktop and touch device, 4 freeze for desktop, 8 freeze for touch device, 12 freeze for desktop and touch device, default value is 1 $dragorientation: 3, //[optional] orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 either, default value is 1 (note that the $dragorientation should be the same as $playorientation when $displaypieces is greater than 1, or parking position is not 0) $arrowkeynavigation: true, //[optional] allows keyboard (arrow key) navigation or not, default value is false $slideduration: 800, //specifies default duration (swipe) for slide in milliseconds $slideshowoptions: { //[optional] options to specify and enable slideshow or not $class: $jssorslideshowrunner$, //[required] class to create instance of slideshow $transitions: _slideshowtransitions, //[required] an array of slideshow transitions to play slideshow $transitionsorder: 1, //[optional] the way to choose transition to play slide, 1 sequence, 0 random $showlink: true //[optional] whether to bring slide link on top of the slider when slideshow is running, default value is false }, $arrownavigatoroptions: { //[optional] options to specify and enable arrow navigator or not $class: $jssorarrownavigator$, //[requried] class to create arrow navigator instance $chancetoshow: 1 //[required] 0 never, 1 mouse over, 2 always }, $thumbnailnavigatoroptions: { //[optional] options to specify and enable thumbnail navigator or not $class: $jssorthumbnailnavigator$, //[required] class to create thumbnail navigator instance $chancetoshow: 2, //[required] 0 never, 1 mouse over, 2 always $actionmode: 1, //[optional] 0 none, 1 act by click, 2 act by mouse hover, 3 both, default value is 1 $spacingx: 8, //[optional] horizontal space between each thumbnail in pixel, default value is 0 $displaypieces: 10, //[optional] number of pieces to display, default value is 1 $parkingposition: 360 //[optional] the offset position to park thumbnail } }; var jssor_banner = new $jssorslider$("banner_container", options); //responsive code begin //you can remove responsive code if you don't want the slider scales while window resizes function scaleslider() { var parentwidth = jssor_banner.$elmt.parentnode.clientwidth; if (parentwidth) jssor_banner.$scalewidth(math.max(math.min(parentwidth, 1920), 300)); else window.settimeout(scaleslider, 30); } scaleslider(); $(window).bind("load", scaleslider); $(window).bind("resize", scaleslider); $(window).bind("orientationchange", scaleslider); //responsive code end });