/*-------------------------------------------------------------------------------------- TBC Slider ======================================================================================*/ $(document).on('cycle-bootstrap', function( e, opts, API ) { API.buildPagerLink = function(opts, slideOpts, slide) { var pagerLink; var pagers = opts.API.getComponent( 'pager' ); pagers.each(function() { var pager = $(this); var markup = $('').text($('h2', slide).text()); pagerLink = $( markup ).appendTo( pager ); pagerLink.on( opts.pagerEvent, function(e) { e.preventDefault(); opts.API.page( pager, e.currentTarget); }); }); }; }); var $tbc_slider = $('#tbc-slider ul').after('
'); var $first_slide = $tbc_slider.find('.first_slide').css({'opacity':0,'display':'block'}); var $progress = $('#tbc-slider .progress'); var $progress_bar = $('#tbc-slider .progressbar'); var slider_imgs = []; if ( $('html').is('.ie6, .ie7, .ie8') && typeof tbc_slider !== 'undefined' && tbc_slider.length > 1 ) { for ( var i = 1; i < tbc_slider.length; i++ ) { $tbc_slider.append(tbc_slider[i].html); } $first_slide.animate({opacity:1},600,function(){ $tbc_slider.cycle({ delay: 600, speed: 800, slides: 'li', overlay: '> .slideinfo_wrap', swipe: true, pauseOnHover: true }); }); } else if ( typeof tbc_slider !== 'undefined' && tbc_slider.length > 1 ) { for ( var j = 0; j < tbc_slider.length; j++ ) { slider_imgs[j] = tbc_slider[j].img[0]; } $.imageloader({ urls: slider_imgs, onUpdate: function(ratio){ $progress_bar.css({'width':ratio*100+'%'}); }, onComplete: function(){ for ( var i = 1; i < tbc_slider.length; i++ ) { $tbc_slider.append(tbc_slider[i].html); } $progress.fadeOut(); $first_slide.animate({opacity:1},600,function(){ $tbc_slider.cycle({ delay: 600, speed: 800, slides: 'li', pager: '.cycle-pager', overlay: '> .slideinfo_wrap', swipe: true, pauseOnHover: true }); }); }, onLoadError: function(){ $progress.fadeOut(); $first_slide.animate({opacity:1}); } }); } else { $first_slide.animate({opacity:1},600); } $window.resize(function() { if ( $html.is('.tbc-fixed-width') ) { var width = $(this).width(); var slider_w = $('#tbc-slider').width(); var margin = (width - slider_w) / 2; $('#tbc-slider').css({'margin-left':margin+'px','margin-right':margin+'px'}); if ( slider_w > width ) { $('#tbc-slider').css({'overflow':'hidden'}); } } });