$(function(){ // $('head').append(''); // $('head').append(''); $.getScript('/js/bxslider/jquery.bxslider.min.js', function(){ initSlider(".about-slider"); }); }); $(window).resize(function(){ resizeImages(); }); function initSlider(element){ $(element).bxSlider({ mode: 'fade', infiniteLoop: true, auto: true, autoStart: true, autoDirection: 'next', autoHover: true, pause: 5000, autoControls: false, pager: true, pagerType: 'full', controls: false, captions: true, speed: 500, onSliderLoad: function(currentIndex) { resizeImages(); } }); } function resizeImages() { $.each($('.sty_banner'),function(i,e){ var me = $(e); // var elm = $(e).children(); var wh = me.height(); var ww = me.width(); if(me.find(".images-list").size() > 0){ var ratio = (600/377); var imgw = wh * ratio; var fh; var fw; if (imgw <= ww) { fh = ww / ratio; fw = ww; } else { fh = wh; fw = imgw; } if(ww <= 767){ wh = wh; fh = fh; } me.find(".images-list-lanscape").show(); me.find(".images-list-lanscape").css({"height":fh,"width":fw}); if (fw >= ww) { me.find('.images-list').css('margin-left', - ((fw - ww)/2) ); me.find('.mobile-detect').css('margin-left', - ((fw - ww)/2) ); me.find('.images-list').css('margin-top', - ((fh - wh)/2) ); me.find('.mobile-detect').css('margin-top', - ((fh - wh)/2) ); } } }) }