$(function () { var $window = $(window), flexslider = { vars: {} }; function getGridSize() { return (window.innerWidth < 680) ? 1 : (window.innerWidth < 960) ? 2 : (window.innerWidth < 1200) ? 3 : 4; } $(window).load(function () { $('#guide .mainimg .flexslider').flexslider({ animation: "fade", animationLoop: true, animationSpeed: 1000, pauseOnHover: true, controlNav: true, directionNav: true, prevText: "", nextText: "", start: function (slider) {} }); }); $(window).load(function () { $('#guide .mainimg_s .flexslider').flexslider({ animation: "fade", animationLoop: true, animationSpeed: 1000, pauseOnHover: true, controlNav: true, directionNav: true, prevText: "", nextText: "", start: function (slider) {} }); }); function getGridSizeBnr() { return (window.innerWidth < 480) ? 1 : (window.innerWidth < 960) ? 3 : (window.innerWidth < 1200) ? 4 : 4; } $(window).load(function () { $('#railway .mainimg_rw .flexslider').flexslider({ animation: "slide", animationLoop: true, animationSpeed: 1000, pauseOnHover: true, controlNav: false, directionNav: true, prevText: "", nextText: "", start: function (slider) {} }); }); $window.load(function () { var width = $(window).width(); if(width <= 767){ $('#guide .detailimg .flexslider').flexslider({ animation: "slide", animationLoop: true, animationSpeed: 1000, pauseOnHover: true, controlNav: "thumbnails", directionNav: true, prevText: "", nextText: "", start: function (slider) {} }); }else{ $('#guide .detailimg .flexslider').flexslider({ animation: "slide", animationLoop: true, animationSpeed: 1000, pauseOnHover: true, controlNav: false, directionNav: true, prevText: "", nextText: "", itemWidth: 500, itemMargin: 5, start: function (slider) {} }); } }); $(window).load(function () { $('#railway .mainimg_s .flexslider').flexslider({ animation: "fade", animationLoop: true, animationSpeed: 1000, pauseOnHover: true, controlNav: true, directionNav: true, prevText: "", nextText: "", start: function (slider) {} }); }); $window.resize(function () { var gridSize = getGridSize(); flexslider.vars.minItems = gridSize; flexslider.vars.maxItems = gridSize; }); });