From: Philippe Barbosa Date: Fri, 4 Mar 2016 11:29:30 +0000 (+0100) Subject: Slider for homepage X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=a593be7be4a2303eebf0b98771590b7a870ad7b0;p=mezzo.git Slider for homepage --- diff --git a/app/festival/static/css/index.css b/app/festival/static/css/index.css index f45b9e65..c62a4efa 100755 --- a/app/festival/static/css/index.css +++ b/app/festival/static/css/index.css @@ -2151,6 +2151,470 @@ th { width: 100%; } +/** + * _Project vendors + */ +/* lightslider - v1.1.5 - 2015-10-31 +* https://github.com/sachinchoolur/lightslider +* Copyright (c) 2015 Sachin N; Licensed MIT */ +/*! lightslider - v1.1.3 - 2015-04-14 +* https://github.com/sachinchoolur/lightslider +* Copyright (c) 2015 Sachin N; Licensed MIT */ +/** /!!! core css Should not edit !!!/**/ +/* line 9, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter { + overflow: hidden; + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +/* line 18, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lightSlider:before, .lightSlider:after { + content: " "; + display: table; +} + +/* line 22, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lightSlider { + overflow: hidden; + margin: 0; +} + +/* line 26, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideWrapper { + max-width: 100%; + overflow: hidden; + position: relative; +} + +/* line 31, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideWrapper > .lightSlider:after { + clear: both; +} + +/* line 34, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideWrapper .lSSlide { + -webkit-transform: translate(0px, 0px); + transform: translate(0px, 0px); + -webkit-transition: all 1s; + transition-property: height,-webkit-transform; + transition-property: transform,height; + transition-property: transform,height,-webkit-transform; + transition-duration: inherit !important; + transition-timing-function: inherit !important; +} + +/* line 47, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideWrapper .lSFade { + position: relative; +} + +/* line 50, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideWrapper .lSFade > * { + position: absolute !important; + top: 0; + left: 0; + z-index: 9; + margin-right: 0; + width: 100%; +} + +/* line 58, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideWrapper.usingCss .lSFade > * { + opacity: 0; + transition-delay: 0s; + transition-duration: inherit !important; + transition-property: opacity; + transition-timing-function: inherit !important; +} + +/* line 69, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideWrapper .lSFade > *.active { + z-index: 10; +} + +/* line 72, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideWrapper.usingCss .lSFade > *.active { + opacity: 1; +} + +/** /!!! End of core css Should not edit !!!/**/ +/* Pager */ +/* line 78, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lSPager.lSpg { + margin: 10px 0 0; + padding: 0; + text-align: center; +} + +/* line 83, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lSPager.lSpg > li { + cursor: pointer; + display: inline-block; + padding: 0 5px; +} + +/* line 88, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lSPager.lSpg > li a { + background-color: #222222; + border-radius: 30px; + display: inline-block; + height: 8px; + overflow: hidden; + text-indent: -999em; + width: 8px; + position: relative; + z-index: 99; + transition: all 0.5s linear 0s; +} + +/* line 101, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lSPager.lSpg > li:hover a, .lSSlideOuter .lSPager.lSpg > li.active a { + background-color: #e8ca88; +} + +/* line 104, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .media { + opacity: 0.8; +} + +/* line 107, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .media.active { + opacity: 1; +} + +/* End of pager */ +/** Gallery */ +/* line 113, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lSPager.lSGallery { + list-style: none outside none; + padding-left: 0; + margin: 0; + overflow: hidden; + transform: translate3d(0px, 0px, 0px); + -moz-transform: translate3d(0px, 0px, 0px); + -ms-transform: translate3d(0px, 0px, 0px); + -webkit-transform: translate3d(0px, 0px, 0px); + -o-transform: translate3d(0px, 0px, 0px); + -webkit-transition-property: -webkit-transform; + -moz-transition-property: -moz-transform; + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +/* line 132, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lSPager.lSGallery li { + overflow: hidden; + transition: border-radius 0.12s linear 0s 0.35s linear 0s; +} + +/* line 137, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lSPager.lSGallery li.active, .lSSlideOuter .lSPager.lSGallery li:hover { + border-radius: 5px; +} + +/* line 140, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lSPager.lSGallery img { + display: block; + height: auto; + max-width: 100%; +} + +/* line 145, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lSPager.lSGallery:before, .lSSlideOuter .lSPager.lSGallery:after { + content: " "; + display: table; +} + +/* line 149, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lSPager.lSGallery:after { + clear: both; +} + +/* End of Gallery*/ +/* slider actions */ +/* line 155, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSAction > a { + width: 32px; + display: block; + top: 50%; + height: 32px; + background-image: url("../img/controls.png"); + cursor: pointer; + position: absolute; + z-index: 99; + margin-top: -16px; + opacity: 0.5; + transition: opacity 0.35s linear 0s; +} + +/* line 169, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSAction > a:hover { + opacity: 1; +} + +/* line 172, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSAction > .lSPrev { + background-position: 0 0; + left: 10px; +} + +/* line 176, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSAction > .lSNext { + background-position: -32px 0; + right: 10px; +} + +/* line 180, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSAction > a.disabled { + pointer-events: none; +} + +/* line 183, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.cS-hidden { + height: 1px; + opacity: 0; + filter: alpha(opacity=0); + overflow: hidden; +} + +/* vertical */ +/* line 192, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.vertical { + position: relative; +} + +/* line 195, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.vertical.noPager { + padding-right: 0px !important; +} + +/* line 198, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.vertical .lSGallery { + position: absolute !important; + right: 0; + top: 0; +} + +/* line 203, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.vertical .lightSlider > * { + width: 100% !important; + max-width: none !important; +} + +/* vertical controlls */ +/* line 209, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.vertical .lSAction > a { + left: 50%; + margin-left: -14px; + margin-top: 0; +} + +/* line 214, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.vertical .lSAction > .lSNext { + background-position: 31px -31px; + bottom: 10px; + top: auto; +} + +/* line 219, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.vertical .lSAction > .lSPrev { + background-position: 0 -31px; + bottom: auto; + top: 10px; +} + +/* vertical */ +/* Rtl */ +/* line 228, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.lSrtl { + direction: rtl; +} + +/* line 231, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lightSlider, .lSSlideOuter .lSPager { + padding-left: 0; + list-style: none outside none; +} + +/* line 235, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.lSrtl .lightSlider, .lSSlideOuter.lSrtl .lSPager { + padding-right: 0; +} + +/* line 238, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .lightSlider > *, .lSSlideOuter .lSGallery li { + float: left; +} + +/* line 241, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.lSrtl .lightSlider > *, .lSSlideOuter.lSrtl .lSGallery li { + float: right !important; +} + +/* Rtl */ +@-webkit-keyframes rightEnd { + 0% { + left: 0; + } + 50% { + left: -15px; + } + 100% { + left: 0; + } +} + +@keyframes rightEnd { + 0% { + left: 0; + } + 50% { + left: -15px; + } + 100% { + left: 0; + } +} + +@-webkit-keyframes topEnd { + 0% { + top: 0; + } + 50% { + top: -15px; + } + 100% { + top: 0; + } +} + +@keyframes topEnd { + 0% { + top: 0; + } + 50% { + top: -15px; + } + 100% { + top: 0; + } +} + +@-webkit-keyframes leftEnd { + 0% { + left: 0; + } + 50% { + left: 15px; + } + 100% { + left: 0; + } +} + +@keyframes leftEnd { + 0% { + left: 0; + } + 50% { + left: 15px; + } + 100% { + left: 0; + } +} + +@-webkit-keyframes bottomEnd { + 0% { + bottom: 0; + } + 50% { + bottom: -15px; + } + 100% { + bottom: 0; + } +} + +@keyframes bottomEnd { + 0% { + bottom: 0; + } + 50% { + bottom: -15px; + } + 100% { + bottom: 0; + } +} + +/* line 350, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .rightEnd { + -webkit-animation: rightEnd 0.3s; + animation: rightEnd 0.3s; + position: relative; +} + +/* line 355, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter .leftEnd { + -webkit-animation: leftEnd 0.3s; + animation: leftEnd 0.3s; + position: relative; +} + +/* line 360, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.vertical .rightEnd { + -webkit-animation: topEnd 0.3s; + animation: topEnd 0.3s; + position: relative; +} + +/* line 365, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.vertical .leftEnd { + -webkit-animation: bottomEnd 0.3s; + animation: bottomEnd 0.3s; + position: relative; +} + +/* line 370, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.lSrtl .rightEnd { + -webkit-animation: leftEnd 0.3s; + animation: leftEnd 0.3s; + position: relative; +} + +/* line 375, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lSSlideOuter.lSrtl .leftEnd { + -webkit-animation: rightEnd 0.3s; + animation: rightEnd 0.3s; + position: relative; +} + +/*/ GRab cursor */ +/* line 381, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lightSlider.lsGrab > * { + cursor: -webkit-grab; + cursor: -o-grab; + cursor: -ms-grab; + cursor: grab; +} + +/* line 388, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/vendors/_lightslider.scss */ +.lightSlider.lsGrabbing > * { + cursor: move; + cursor: -webkit-grabbing; + cursor: -o-grabbing; + cursor: -ms-grabbing; + cursor: grabbing; +} + /** * _Modules */ @@ -2262,6 +2726,15 @@ th { color: #d7a433; } +/* line 5, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/modules/hero-slider.scss */ +.hero__slider__item { + display: block; + width: 100%; + height: 500px; + background: #e8ca88 no-repeat center; + background-size: cover; +} + /* line 1, /Users/philippebarbosa/Sites/ircam-manifeste/app/festival/static/scss/modules/user.scss */ .user__panel { margin: 1rem auto; diff --git a/app/festival/static/img/controls.png b/app/festival/static/img/controls.png new file mode 100755 index 00000000..03dc4cf2 Binary files /dev/null and b/app/festival/static/img/controls.png differ diff --git a/app/festival/static/js/index.js b/app/festival/static/js/index.js index facd2767..0872f936 100644 --- a/app/festival/static/js/index.js +++ b/app/festival/static/js/index.js @@ -31,4 +31,61 @@ $(function() { $('#language_selector_form').change(function() { this.submit(); }); $('#language_selector_form input').hide(); + /** + * Lightslider + */ + $("#lightSlider").lightSlider({ + item: 1, + autoWidth: false, + slideMove: 1, // slidemove will be 1 if loop is true + slideMargin: 10, + + addClass: '', + mode: "fade", + useCSS: true, + cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)',// + easing: 'linear', //'for jquery animation',//// + + speed: 400, //ms' + auto: false, + loop: false, + slideEndAnimation: true, + pause: 2000, + + keyPress: true, + controls: true, + prevHtml: '', + nextHtml: '', + + rtl:false, + adaptiveHeight:false, + + vertical:false, + verticalHeight:500, + vThumbWidth:100, + + thumbItem:10, + pager: true, + gallery: false, + galleryMargin: 5, + thumbMargin: 5, + currentPagerPosition: 'middle', + + enableTouch:true, + enableDrag:false, + freeMove:false, + swipeThreshold: 40, + + responsive : [], + + onBeforeStart: function (el) {}, + onSliderLoad: function (el) {}, + onBeforeSlide: function (el) {}, + onAfterSlide: function (el) { + // el.find('.container').fadeIn(); + }, + onBeforeNextSlide: function (el) {}, + onBeforePrevSlide: function (el) {} + }); + }); \ No newline at end of file diff --git a/app/festival/static/js/plugins.js b/app/festival/static/js/plugins.js index a2355c9c..0942fdee 100644 --- a/app/festival/static/js/plugins.js +++ b/app/festival/static/js/plugins.js @@ -1,3 +1,1146 @@ +/*! lightslider - v1.1.5 - 2015-10-31 +* https://github.com/sachinchoolur/lightslider +* Copyright (c) 2015 Sachin N; Licensed MIT */ +(function ($, undefined) { + 'use strict'; + var defaults = { + item: 3, + autoWidth: false, + slideMove: 1, + slideMargin: 10, + addClass: '', + mode: 'slide', + useCSS: true, + cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)', + easing: 'linear', //'for jquery animation',// + speed: 400, //ms' + auto: false, + pauseOnHover: false, + loop: false, + slideEndAnimation: true, + pause: 2000, + keyPress: false, + controls: true, + prevHtml: '', + nextHtml: '', + rtl: false, + adaptiveHeight: false, + vertical: false, + verticalHeight: 500, + vThumbWidth: 100, + thumbItem: 10, + pager: true, + gallery: false, + galleryMargin: 5, + thumbMargin: 5, + currentPagerPosition: 'middle', + enableTouch: true, + enableDrag: true, + freeMove: true, + swipeThreshold: 40, + responsive: [], + /* jshint ignore:start */ + onBeforeStart: function ($el) {}, + onSliderLoad: function ($el) {}, + onBeforeSlide: function ($el, scene) {}, + onAfterSlide: function ($el, scene) {}, + onBeforeNextSlide: function ($el, scene) {}, + onBeforePrevSlide: function ($el, scene) {} + /* jshint ignore:end */ + }; + $.fn.lightSlider = function (options) { + if (this.length === 0) { + return this; + } + + if (this.length > 1) { + this.each(function () { + $(this).lightSlider(options); + }); + return this; + } + + var plugin = {}, + settings = $.extend(true, {}, defaults, options), + settingsTemp = {}, + $el = this; + plugin.$el = this; + + if (settings.mode === 'fade') { + settings.vertical = false; + } + var $children = $el.children(), + windowW = $(window).width(), + breakpoint = null, + resposiveObj = null, + length = 0, + w = 0, + on = false, + elSize = 0, + $slide = '', + scene = 0, + property = (settings.vertical === true) ? 'height' : 'width', + gutter = (settings.vertical === true) ? 'margin-bottom' : 'margin-right', + slideValue = 0, + pagerWidth = 0, + slideWidth = 0, + thumbWidth = 0, + interval = null, + isTouch = ('ontouchstart' in document.documentElement); + var refresh = {}; + + refresh.chbreakpoint = function () { + windowW = $(window).width(); + if (settings.responsive.length) { + var item; + if (settings.autoWidth === false) { + item = settings.item; + } + if (windowW < settings.responsive[0].breakpoint) { + for (var i = 0; i < settings.responsive.length; i++) { + if (windowW < settings.responsive[i].breakpoint) { + breakpoint = settings.responsive[i].breakpoint; + resposiveObj = settings.responsive[i]; + } + } + } + if (typeof resposiveObj !== 'undefined' && resposiveObj !== null) { + for (var j in resposiveObj.settings) { + if (resposiveObj.settings.hasOwnProperty(j)) { + if (typeof settingsTemp[j] === 'undefined' || settingsTemp[j] === null) { + settingsTemp[j] = settings[j]; + } + settings[j] = resposiveObj.settings[j]; + } + } + } + if (!$.isEmptyObject(settingsTemp) && windowW > settings.responsive[0].breakpoint) { + for (var k in settingsTemp) { + if (settingsTemp.hasOwnProperty(k)) { + settings[k] = settingsTemp[k]; + } + } + } + if (settings.autoWidth === false) { + if (slideValue > 0 && slideWidth > 0) { + if (item !== settings.item) { + scene = Math.round(slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove)); + } + } + } + } + }; + + refresh.calSW = function () { + if (settings.autoWidth === false) { + slideWidth = (elSize - ((settings.item * (settings.slideMargin)) - settings.slideMargin)) / settings.item; + } + }; + + refresh.calWidth = function (cln) { + var ln = cln === true ? $slide.find('.lslide').length : $children.length; + if (settings.autoWidth === false) { + w = ln * (slideWidth + settings.slideMargin); + } else { + w = 0; + for (var i = 0; i < ln; i++) { + w += (parseInt($children.eq(i).width()) + settings.slideMargin); + } + } + return w; + }; + plugin = { + doCss: function () { + var support = function () { + var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; + var root = document.documentElement; + for (var i = 0; i < transition.length; i++) { + if (transition[i] in root.style) { + return true; + } + } + }; + if (settings.useCSS && support()) { + return true; + } + return false; + }, + keyPress: function () { + if (settings.keyPress) { + $(document).on('keyup.lightslider', function (e) { + if (!$(':focus').is('input, textarea')) { + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + if (e.keyCode === 37) { + $el.goToPrevSlide(); + } else if (e.keyCode === 39) { + $el.goToNextSlide(); + } + } + }); + } + }, + controls: function () { + if (settings.controls) { + $el.after('
' + settings.prevHtml + '' + settings.nextHtml + '
'); + if (!settings.autoWidth) { + if (length <= settings.item) { + $slide.find('.lSAction').hide(); + } + } else { + if (refresh.calWidth(false) < elSize) { + $slide.find('.lSAction').hide(); + } + } + $slide.find('.lSAction a').on('click', function (e) { + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + if ($(this).attr('class') === 'lSPrev') { + $el.goToPrevSlide(); + } else { + $el.goToNextSlide(); + } + return false; + }); + } + }, + initialStyle: function () { + var $this = this; + if (settings.mode === 'fade') { + settings.autoWidth = false; + settings.slideEndAnimation = false; + } + if (settings.auto) { + settings.slideEndAnimation = false; + } + if (settings.autoWidth) { + settings.slideMove = 1; + settings.item = 1; + } + if (settings.loop) { + settings.slideMove = 1; + settings.freeMove = false; + } + settings.onBeforeStart.call(this, $el); + refresh.chbreakpoint(); + $el.addClass('lightSlider').wrap('
'); + $slide = $el.parent('.lSSlideWrapper'); + if (settings.rtl === true) { + $slide.parent().addClass('lSrtl'); + } + if (settings.vertical) { + $slide.parent().addClass('vertical'); + elSize = settings.verticalHeight; + $slide.css('height', elSize + 'px'); + } else { + elSize = $el.outerWidth(); + } + $children.addClass('lslide'); + if (settings.loop === true && settings.mode === 'slide') { + refresh.calSW(); + refresh.clone = function () { + if (refresh.calWidth(true) > elSize) { + /**/ + var tWr = 0, + tI = 0; + for (var k = 0; k < $children.length; k++) { + tWr += (parseInt($el.find('.lslide').eq(k).width()) + settings.slideMargin); + tI++; + if (tWr >= (elSize + settings.slideMargin)) { + break; + } + } + var tItem = settings.autoWidth === true ? tI : settings.item; + + /**/ + if (tItem < $el.find('.clone.left').length) { + for (var i = 0; i < $el.find('.clone.left').length - tItem; i++) { + $children.eq(i).remove(); + } + } + if (tItem < $el.find('.clone.right').length) { + for (var j = $children.length - 1; j > ($children.length - 1 - $el.find('.clone.right').length); j--) { + scene--; + $children.eq(j).remove(); + } + } + /**/ + for (var n = $el.find('.clone.right').length; n < tItem; n++) { + $el.find('.lslide').eq(n).clone().removeClass('lslide').addClass('clone right').appendTo($el); + scene++; + } + for (var m = $el.find('.lslide').length - $el.find('.clone.left').length; m > ($el.find('.lslide').length - tItem); m--) { + $el.find('.lslide').eq(m - 1).clone().removeClass('lslide').addClass('clone left').prependTo($el); + } + $children = $el.children(); + } else { + if ($children.hasClass('clone')) { + $el.find('.clone').remove(); + $this.move($el, 0); + } + } + }; + refresh.clone(); + } + refresh.sSW = function () { + length = $children.length; + if (settings.rtl === true && settings.vertical === false) { + gutter = 'margin-left'; + } + if (settings.autoWidth === false) { + $children.css(property, slideWidth + 'px'); + } + $children.css(gutter, settings.slideMargin + 'px'); + w = refresh.calWidth(false); + $el.css(property, w + 'px'); + if (settings.loop === true && settings.mode === 'slide') { + if (on === false) { + scene = $el.find('.clone.left').length; + } + } + }; + refresh.calL = function () { + $children = $el.children(); + length = $children.length; + }; + if (this.doCss()) { + $slide.addClass('usingCss'); + } + refresh.calL(); + if (settings.mode === 'slide') { + refresh.calSW(); + refresh.sSW(); + if (settings.loop === true) { + slideValue = $this.slideValue(); + this.move($el, slideValue); + } + if (settings.vertical === false) { + this.setHeight($el, false); + } + + } else { + this.setHeight($el, true); + $el.addClass('lSFade'); + if (!this.doCss()) { + $children.fadeOut(0); + $children.eq(scene).fadeIn(0); + } + } + if (settings.loop === true && settings.mode === 'slide') { + $children.eq(scene).addClass('active'); + } else { + $children.first().addClass('active'); + } + }, + pager: function () { + var $this = this; + refresh.createPager = function () { + thumbWidth = (elSize - ((settings.thumbItem * (settings.thumbMargin)) - settings.thumbMargin)) / settings.thumbItem; + var $children = $slide.find('.lslide'); + var length = $slide.find('.lslide').length; + var i = 0, + pagers = '', + v = 0; + for (i = 0; i < length; i++) { + if (settings.mode === 'slide') { + // calculate scene * slide value + if (!settings.autoWidth) { + v = i * ((slideWidth + settings.slideMargin) * settings.slideMove); + } else { + v += ((parseInt($children.eq(i).width()) + settings.slideMargin) * settings.slideMove); + } + } + var thumb = $children.eq(i * settings.slideMove).attr('data-thumb'); + if (settings.gallery === true) { + pagers += '
  • '; + } else { + pagers += '
  • ' + (i + 1) + '
  • '; + } + if (settings.mode === 'slide') { + if ((v) >= w - elSize - settings.slideMargin) { + i = i + 1; + var minPgr = 2; + if (settings.autoWidth) { + pagers += '
  • ' + (i + 1) + '
  • '; + minPgr = 1; + } + if (i < minPgr) { + pagers = null; + $slide.parent().addClass('noPager'); + } else { + $slide.parent().removeClass('noPager'); + } + break; + } + } + } + var $cSouter = $slide.parent(); + $cSouter.find('.lSPager').html(pagers); + if (settings.gallery === true) { + if (settings.vertical === true) { + // set Gallery thumbnail width + $cSouter.find('.lSPager').css('width', settings.vThumbWidth + 'px'); + } + pagerWidth = (i * (settings.thumbMargin + thumbWidth)) + 0.5; + $cSouter.find('.lSPager').css({ + property: pagerWidth + 'px', + 'transition-duration': settings.speed + 'ms' + }); + if (settings.vertical === true) { + $slide.parent().css('padding-right', (settings.vThumbWidth + settings.galleryMargin) + 'px'); + } + $cSouter.find('.lSPager').css(property, pagerWidth + 'px'); + } + var $pager = $cSouter.find('.lSPager').find('li'); + $pager.first().addClass('active'); + $pager.on('click', function () { + if (settings.loop === true && settings.mode === 'slide') { + scene = scene + ($pager.index(this) - $cSouter.find('.lSPager').find('li.active').index()); + } else { + scene = $pager.index(this); + } + $el.mode(false); + if (settings.gallery === true) { + $this.slideThumb(); + } + return false; + }); + }; + if (settings.pager) { + var cl = 'lSpg'; + if (settings.gallery) { + cl = 'lSGallery'; + } + $slide.after(''); + var gMargin = (settings.vertical) ? 'margin-left' : 'margin-top'; + $slide.parent().find('.lSPager').css(gMargin, settings.galleryMargin + 'px'); + refresh.createPager(); + } + + setTimeout(function () { + refresh.init(); + }, 0); + }, + setHeight: function (ob, fade) { + var obj = null, + $this = this; + if (settings.loop) { + obj = ob.children('.lslide ').first(); + } else { + obj = ob.children().first(); + } + var setCss = function () { + var tH = obj.outerHeight(), + tP = 0, + tHT = tH; + if (fade) { + tH = 0; + tP = ((tHT) * 100) / elSize; + } + ob.css({ + 'height': tH + 'px', + 'padding-bottom': tP + '%' + }); + }; + setCss(); + if (obj.find('img').length) { + if ( obj.find('img')[0].complete) { + setCss(); + if (!interval) { + $this.auto(); + } + }else{ + obj.find('img').load(function () { + setTimeout(function () { + setCss(); + if (!interval) { + $this.auto(); + } + }, 100); + }); + } + }else{ + if (!interval) { + $this.auto(); + } + } + }, + active: function (ob, t) { + if (this.doCss() && settings.mode === 'fade') { + $slide.addClass('on'); + } + var sc = 0; + if (scene * settings.slideMove < length) { + ob.removeClass('active'); + if (!this.doCss() && settings.mode === 'fade' && t === false) { + ob.fadeOut(settings.speed); + } + if (t === true) { + sc = scene; + } else { + sc = scene * settings.slideMove; + } + //t === true ? sc = scene : sc = scene * settings.slideMove; + var l, nl; + if (t === true) { + l = ob.length; + nl = l - 1; + if (sc + 1 >= l) { + sc = nl; + } + } + if (settings.loop === true && settings.mode === 'slide') { + //t === true ? sc = scene - $el.find('.clone.left').length : sc = scene * settings.slideMove; + if (t === true) { + sc = scene - $el.find('.clone.left').length; + } else { + sc = scene * settings.slideMove; + } + if (t === true) { + l = ob.length; + nl = l - 1; + if (sc + 1 === l) { + sc = nl; + } else if (sc + 1 > l) { + sc = 0; + } + } + } + + if (!this.doCss() && settings.mode === 'fade' && t === false) { + ob.eq(sc).fadeIn(settings.speed); + } + ob.eq(sc).addClass('active'); + } else { + ob.removeClass('active'); + ob.eq(ob.length - 1).addClass('active'); + if (!this.doCss() && settings.mode === 'fade' && t === false) { + ob.fadeOut(settings.speed); + ob.eq(sc).fadeIn(settings.speed); + } + } + }, + move: function (ob, v) { + if (settings.rtl === true) { + v = -v; + } + if (this.doCss()) { + if (settings.vertical === true) { + ob.css({ + 'transform': 'translate3d(0px, ' + (-v) + 'px, 0px)', + '-webkit-transform': 'translate3d(0px, ' + (-v) + 'px, 0px)' + }); + } else { + ob.css({ + 'transform': 'translate3d(' + (-v) + 'px, 0px, 0px)', + '-webkit-transform': 'translate3d(' + (-v) + 'px, 0px, 0px)', + }); + } + } else { + if (settings.vertical === true) { + ob.css('position', 'relative').animate({ + top: -v + 'px' + }, settings.speed, settings.easing); + } else { + ob.css('position', 'relative').animate({ + left: -v + 'px' + }, settings.speed, settings.easing); + } + } + var $thumb = $slide.parent().find('.lSPager').find('li'); + this.active($thumb, true); + }, + fade: function () { + this.active($children, false); + var $thumb = $slide.parent().find('.lSPager').find('li'); + this.active($thumb, true); + }, + slide: function () { + var $this = this; + refresh.calSlide = function () { + if (w > elSize) { + slideValue = $this.slideValue(); + $this.active($children, false); + if ((slideValue) > w - elSize - settings.slideMargin) { + slideValue = w - elSize - settings.slideMargin; + } else if (slideValue < 0) { + slideValue = 0; + } + $this.move($el, slideValue); + if (settings.loop === true && settings.mode === 'slide') { + if (scene >= (length - ($el.find('.clone.left').length / settings.slideMove))) { + $this.resetSlide($el.find('.clone.left').length); + } + if (scene === 0) { + $this.resetSlide($slide.find('.lslide').length); + } + } + } + }; + refresh.calSlide(); + }, + resetSlide: function (s) { + var $this = this; + $slide.find('.lSAction a').addClass('disabled'); + setTimeout(function () { + scene = s; + $slide.css('transition-duration', '0ms'); + slideValue = $this.slideValue(); + $this.active($children, false); + plugin.move($el, slideValue); + setTimeout(function () { + $slide.css('transition-duration', settings.speed + 'ms'); + $slide.find('.lSAction a').removeClass('disabled'); + }, 50); + }, settings.speed + 100); + }, + slideValue: function () { + var _sV = 0; + if (settings.autoWidth === false) { + _sV = scene * ((slideWidth + settings.slideMargin) * settings.slideMove); + } else { + _sV = 0; + for (var i = 0; i < scene; i++) { + _sV += (parseInt($children.eq(i).width()) + settings.slideMargin); + } + } + return _sV; + }, + slideThumb: function () { + var position; + switch (settings.currentPagerPosition) { + case 'left': + position = 0; + break; + case 'middle': + position = (elSize / 2) - (thumbWidth / 2); + break; + case 'right': + position = elSize - thumbWidth; + } + var sc = scene - $el.find('.clone.left').length; + var $pager = $slide.parent().find('.lSPager'); + if (settings.mode === 'slide' && settings.loop === true) { + if (sc >= $pager.children().length) { + sc = 0; + } else if (sc < 0) { + sc = $pager.children().length; + } + } + var thumbSlide = sc * ((thumbWidth + settings.thumbMargin)) - (position); + if ((thumbSlide + elSize) > pagerWidth) { + thumbSlide = pagerWidth - elSize - settings.thumbMargin; + } + if (thumbSlide < 0) { + thumbSlide = 0; + } + this.move($pager, thumbSlide); + }, + auto: function () { + if (settings.auto) { + clearInterval(interval); + interval = setInterval(function () { + $el.goToNextSlide(); + }, settings.pause); + } + }, + pauseOnHover: function(){ + var $this = this; + if (settings.auto && settings.pauseOnHover) { + $slide.on('mouseenter', function(){ + $(this).addClass('ls-hover'); + $el.pause(); + settings.auto = true; + }); + $slide.on('mouseleave',function(){ + $(this).removeClass('ls-hover'); + if (!$slide.find('.lightSlider').hasClass('lsGrabbing')) { + $this.auto(); + } + }); + } + }, + touchMove: function (endCoords, startCoords) { + $slide.css('transition-duration', '0ms'); + if (settings.mode === 'slide') { + var distance = endCoords - startCoords; + var swipeVal = slideValue - distance; + if ((swipeVal) >= w - elSize - settings.slideMargin) { + if (settings.freeMove === false) { + swipeVal = w - elSize - settings.slideMargin; + } else { + var swipeValT = w - elSize - settings.slideMargin; + swipeVal = swipeValT + ((swipeVal - swipeValT) / 5); + + } + } else if (swipeVal < 0) { + if (settings.freeMove === false) { + swipeVal = 0; + } else { + swipeVal = swipeVal / 5; + } + } + this.move($el, swipeVal); + } + }, + + touchEnd: function (distance) { + $slide.css('transition-duration', settings.speed + 'ms'); + if (settings.mode === 'slide') { + var mxVal = false; + var _next = true; + slideValue = slideValue - distance; + if ((slideValue) > w - elSize - settings.slideMargin) { + slideValue = w - elSize - settings.slideMargin; + if (settings.autoWidth === false) { + mxVal = true; + } + } else if (slideValue < 0) { + slideValue = 0; + } + var gC = function (next) { + var ad = 0; + if (!mxVal) { + if (next) { + ad = 1; + } + } + if (!settings.autoWidth) { + var num = slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove); + scene = parseInt(num) + ad; + if (slideValue >= (w - elSize - settings.slideMargin)) { + if (num % 1 !== 0) { + scene++; + } + } + } else { + var tW = 0; + for (var i = 0; i < $children.length; i++) { + tW += (parseInt($children.eq(i).width()) + settings.slideMargin); + scene = i + ad; + if (tW >= slideValue) { + break; + } + } + } + }; + if (distance >= settings.swipeThreshold) { + gC(false); + _next = false; + } else if (distance <= -settings.swipeThreshold) { + gC(true); + _next = false; + } + $el.mode(_next); + this.slideThumb(); + } else { + if (distance >= settings.swipeThreshold) { + $el.goToPrevSlide(); + } else if (distance <= -settings.swipeThreshold) { + $el.goToNextSlide(); + } + } + }, + + + + enableDrag: function () { + var $this = this; + if (!isTouch) { + var startCoords = 0, + endCoords = 0, + isDraging = false; + $slide.find('.lightSlider').addClass('lsGrab'); + $slide.on('mousedown', function (e) { + if (w < elSize) { + if (w !== 0) { + return false; + } + } + if ($(e.target).attr('class') !== ('lSPrev') && $(e.target).attr('class') !== ('lSNext')) { + startCoords = (settings.vertical === true) ? e.pageY : e.pageX; + isDraging = true; + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 + $slide.scrollLeft += 1; + $slide.scrollLeft -= 1; + // * + $slide.find('.lightSlider').removeClass('lsGrab').addClass('lsGrabbing'); + clearInterval(interval); + } + }); + $(window).on('mousemove', function (e) { + if (isDraging) { + endCoords = (settings.vertical === true) ? e.pageY : e.pageX; + $this.touchMove(endCoords, startCoords); + } + }); + $(window).on('mouseup', function (e) { + if (isDraging) { + $slide.find('.lightSlider').removeClass('lsGrabbing').addClass('lsGrab'); + isDraging = false; + endCoords = (settings.vertical === true) ? e.pageY : e.pageX; + var distance = endCoords - startCoords; + if (Math.abs(distance) >= settings.swipeThreshold) { + $(window).on('click.ls', function (e) { + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + e.stopImmediatePropagation(); + e.stopPropagation(); + $(window).off('click.ls'); + }); + } + + $this.touchEnd(distance); + + } + }); + } + }, + + + + + enableTouch: function () { + var $this = this; + if (isTouch) { + var startCoords = {}, + endCoords = {}; + $slide.on('touchstart', function (e) { + endCoords = e.originalEvent.targetTouches[0]; + startCoords.pageX = e.originalEvent.targetTouches[0].pageX; + startCoords.pageY = e.originalEvent.targetTouches[0].pageY; + clearInterval(interval); + }); + $slide.on('touchmove', function (e) { + if (w < elSize) { + if (w !== 0) { + return false; + } + } + var orig = e.originalEvent; + endCoords = orig.targetTouches[0]; + var xMovement = Math.abs(endCoords.pageX - startCoords.pageX); + var yMovement = Math.abs(endCoords.pageY - startCoords.pageY); + if (settings.vertical === true) { + if ((yMovement * 3) > xMovement) { + e.preventDefault(); + } + $this.touchMove(endCoords.pageY, startCoords.pageY); + } else { + if ((xMovement * 3) > yMovement) { + e.preventDefault(); + } + $this.touchMove(endCoords.pageX, startCoords.pageX); + } + + }); + $slide.on('touchend', function () { + if (w < elSize) { + if (w !== 0) { + return false; + } + } + var distance; + if (settings.vertical === true) { + distance = endCoords.pageY - startCoords.pageY; + } else { + distance = endCoords.pageX - startCoords.pageX; + } + $this.touchEnd(distance); + }); + } + }, + build: function () { + var $this = this; + $this.initialStyle(); + if (this.doCss()) { + + if (settings.enableTouch === true) { + $this.enableTouch(); + } + if (settings.enableDrag === true) { + $this.enableDrag(); + } + } + + $(window).on('focus', function(){ + $this.auto(); + }); + + $(window).on('blur', function(){ + clearInterval(interval); + }); + + $this.pager(); + $this.pauseOnHover(); + $this.controls(); + $this.keyPress(); + } + }; + plugin.build(); + refresh.init = function () { + refresh.chbreakpoint(); + if (settings.vertical === true) { + if (settings.item > 1) { + elSize = settings.verticalHeight; + } else { + elSize = $children.outerHeight(); + } + $slide.css('height', elSize + 'px'); + } else { + elSize = $slide.outerWidth(); + } + if (settings.loop === true && settings.mode === 'slide') { + refresh.clone(); + } + refresh.calL(); + if (settings.mode === 'slide') { + $el.removeClass('lSSlide'); + } + if (settings.mode === 'slide') { + refresh.calSW(); + refresh.sSW(); + } + setTimeout(function () { + if (settings.mode === 'slide') { + $el.addClass('lSSlide'); + } + }, 1000); + if (settings.pager) { + refresh.createPager(); + } + if (settings.adaptiveHeight === true && settings.vertical === false) { + $el.css('height', $children.eq(scene).outerHeight(true)); + } + if (settings.adaptiveHeight === false) { + if (settings.mode === 'slide') { + if (settings.vertical === false) { + plugin.setHeight($el, false); + }else{ + plugin.auto(); + } + } else { + plugin.setHeight($el, true); + } + } + if (settings.gallery === true) { + plugin.slideThumb(); + } + if (settings.mode === 'slide') { + plugin.slide(); + } + if (settings.autoWidth === false) { + if ($children.length <= settings.item) { + $slide.find('.lSAction').hide(); + } else { + $slide.find('.lSAction').show(); + } + } else { + if ((refresh.calWidth(false) < elSize) && (w !== 0)) { + $slide.find('.lSAction').hide(); + } else { + $slide.find('.lSAction').show(); + } + } + }; + $el.goToPrevSlide = function () { + if (scene > 0) { + settings.onBeforePrevSlide.call(this, $el, scene); + scene--; + $el.mode(false); + if (settings.gallery === true) { + plugin.slideThumb(); + } + } else { + if (settings.loop === true) { + settings.onBeforePrevSlide.call(this, $el, scene); + if (settings.mode === 'fade') { + var l = (length - 1); + scene = parseInt(l / settings.slideMove); + } + $el.mode(false); + if (settings.gallery === true) { + plugin.slideThumb(); + } + } else if (settings.slideEndAnimation === true) { + $el.addClass('leftEnd'); + setTimeout(function () { + $el.removeClass('leftEnd'); + }, 400); + } + } + }; + $el.goToNextSlide = function () { + var nextI = true; + if (settings.mode === 'slide') { + var _slideValue = plugin.slideValue(); + nextI = _slideValue < w - elSize - settings.slideMargin; + } + if (((scene * settings.slideMove) < length - settings.slideMove) && nextI) { + settings.onBeforeNextSlide.call(this, $el, scene); + scene++; + $el.mode(false); + if (settings.gallery === true) { + plugin.slideThumb(); + } + } else { + if (settings.loop === true) { + settings.onBeforeNextSlide.call(this, $el, scene); + scene = 0; + $el.mode(false); + if (settings.gallery === true) { + plugin.slideThumb(); + } + } else if (settings.slideEndAnimation === true) { + $el.addClass('rightEnd'); + setTimeout(function () { + $el.removeClass('rightEnd'); + }, 400); + } + } + }; + $el.mode = function (_touch) { + if (settings.adaptiveHeight === true && settings.vertical === false) { + $el.css('height', $children.eq(scene).outerHeight(true)); + } + if (on === false) { + if (settings.mode === 'slide') { + if (plugin.doCss()) { + $el.addClass('lSSlide'); + if (settings.speed !== '') { + $slide.css('transition-duration', settings.speed + 'ms'); + } + if (settings.cssEasing !== '') { + $slide.css('transition-timing-function', settings.cssEasing); + } + } + } else { + if (plugin.doCss()) { + if (settings.speed !== '') { + $el.css('transition-duration', settings.speed + 'ms'); + } + if (settings.cssEasing !== '') { + $el.css('transition-timing-function', settings.cssEasing); + } + } + } + } + if (!_touch) { + settings.onBeforeSlide.call(this, $el, scene); + } + if (settings.mode === 'slide') { + plugin.slide(); + } else { + plugin.fade(); + } + if (!$slide.hasClass('ls-hover')) { + plugin.auto(); + } + setTimeout(function () { + if (!_touch) { + settings.onAfterSlide.call(this, $el, scene); + } + }, settings.speed); + on = true; + }; + $el.play = function () { + $el.goToNextSlide(); + settings.auto = true; + plugin.auto(); + }; + $el.pause = function () { + settings.auto = false; + clearInterval(interval); + }; + $el.refresh = function () { + refresh.init(); + }; + $el.getCurrentSlideCount = function () { + var sc = scene; + if (settings.loop) { + var ln = $slide.find('.lslide').length, + cl = $el.find('.clone.left').length; + if (scene <= cl - 1) { + sc = ln + (scene - cl); + } else if (scene >= (ln + cl)) { + sc = scene - ln - cl; + } else { + sc = scene - cl; + } + } + return sc + 1; + }; + $el.getTotalSlideCount = function () { + return $slide.find('.lslide').length; + }; + $el.goToSlide = function (s) { + if (settings.loop) { + scene = (s + $el.find('.clone.left').length - 1); + } else { + scene = s; + } + $el.mode(false); + if (settings.gallery === true) { + plugin.slideThumb(); + } + }; + $el.destroy = function () { + if ($el.lightSlider) { + $el.goToPrevSlide = function(){}; + $el.goToNextSlide = function(){}; + $el.mode = function(){}; + $el.play = function(){}; + $el.pause = function(){}; + $el.refresh = function(){}; + $el.getCurrentSlideCount = function(){}; + $el.getTotalSlideCount = function(){}; + $el.goToSlide = function(){}; + $el.lightSlider = null; + refresh = { + init : function(){} + }; + $el.parent().parent().find('.lSAction, .lSPager').remove(); + $el.removeClass('lightSlider lSFade lSSlide lsGrab lsGrabbing leftEnd right').removeAttr('style').unwrap().unwrap(); + $el.children().removeAttr('style'); + $children.removeClass('lslide active'); + $el.find('.clone').remove(); + $children = null; + interval = null; + on = false; + scene = 0; + } + + }; + setTimeout(function () { + settings.onSliderLoad.call(this, $el); + }, 10); + $(window).on('resize orientationchange', function (e) { + setTimeout(function () { + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + refresh.init(); + }, 200); + }); + return this; + }; +}(jQuery)); /*! * Masonry PACKAGED v4.0.0 * Cascading grid layout library diff --git a/app/festival/static/js/plugins/lightslider.js b/app/festival/static/js/plugins/lightslider.js new file mode 100755 index 00000000..70f94d5c --- /dev/null +++ b/app/festival/static/js/plugins/lightslider.js @@ -0,0 +1,1143 @@ +/*! lightslider - v1.1.5 - 2015-10-31 +* https://github.com/sachinchoolur/lightslider +* Copyright (c) 2015 Sachin N; Licensed MIT */ +(function ($, undefined) { + 'use strict'; + var defaults = { + item: 3, + autoWidth: false, + slideMove: 1, + slideMargin: 10, + addClass: '', + mode: 'slide', + useCSS: true, + cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)', + easing: 'linear', //'for jquery animation',// + speed: 400, //ms' + auto: false, + pauseOnHover: false, + loop: false, + slideEndAnimation: true, + pause: 2000, + keyPress: false, + controls: true, + prevHtml: '', + nextHtml: '', + rtl: false, + adaptiveHeight: false, + vertical: false, + verticalHeight: 500, + vThumbWidth: 100, + thumbItem: 10, + pager: true, + gallery: false, + galleryMargin: 5, + thumbMargin: 5, + currentPagerPosition: 'middle', + enableTouch: true, + enableDrag: true, + freeMove: true, + swipeThreshold: 40, + responsive: [], + /* jshint ignore:start */ + onBeforeStart: function ($el) {}, + onSliderLoad: function ($el) {}, + onBeforeSlide: function ($el, scene) {}, + onAfterSlide: function ($el, scene) {}, + onBeforeNextSlide: function ($el, scene) {}, + onBeforePrevSlide: function ($el, scene) {} + /* jshint ignore:end */ + }; + $.fn.lightSlider = function (options) { + if (this.length === 0) { + return this; + } + + if (this.length > 1) { + this.each(function () { + $(this).lightSlider(options); + }); + return this; + } + + var plugin = {}, + settings = $.extend(true, {}, defaults, options), + settingsTemp = {}, + $el = this; + plugin.$el = this; + + if (settings.mode === 'fade') { + settings.vertical = false; + } + var $children = $el.children(), + windowW = $(window).width(), + breakpoint = null, + resposiveObj = null, + length = 0, + w = 0, + on = false, + elSize = 0, + $slide = '', + scene = 0, + property = (settings.vertical === true) ? 'height' : 'width', + gutter = (settings.vertical === true) ? 'margin-bottom' : 'margin-right', + slideValue = 0, + pagerWidth = 0, + slideWidth = 0, + thumbWidth = 0, + interval = null, + isTouch = ('ontouchstart' in document.documentElement); + var refresh = {}; + + refresh.chbreakpoint = function () { + windowW = $(window).width(); + if (settings.responsive.length) { + var item; + if (settings.autoWidth === false) { + item = settings.item; + } + if (windowW < settings.responsive[0].breakpoint) { + for (var i = 0; i < settings.responsive.length; i++) { + if (windowW < settings.responsive[i].breakpoint) { + breakpoint = settings.responsive[i].breakpoint; + resposiveObj = settings.responsive[i]; + } + } + } + if (typeof resposiveObj !== 'undefined' && resposiveObj !== null) { + for (var j in resposiveObj.settings) { + if (resposiveObj.settings.hasOwnProperty(j)) { + if (typeof settingsTemp[j] === 'undefined' || settingsTemp[j] === null) { + settingsTemp[j] = settings[j]; + } + settings[j] = resposiveObj.settings[j]; + } + } + } + if (!$.isEmptyObject(settingsTemp) && windowW > settings.responsive[0].breakpoint) { + for (var k in settingsTemp) { + if (settingsTemp.hasOwnProperty(k)) { + settings[k] = settingsTemp[k]; + } + } + } + if (settings.autoWidth === false) { + if (slideValue > 0 && slideWidth > 0) { + if (item !== settings.item) { + scene = Math.round(slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove)); + } + } + } + } + }; + + refresh.calSW = function () { + if (settings.autoWidth === false) { + slideWidth = (elSize - ((settings.item * (settings.slideMargin)) - settings.slideMargin)) / settings.item; + } + }; + + refresh.calWidth = function (cln) { + var ln = cln === true ? $slide.find('.lslide').length : $children.length; + if (settings.autoWidth === false) { + w = ln * (slideWidth + settings.slideMargin); + } else { + w = 0; + for (var i = 0; i < ln; i++) { + w += (parseInt($children.eq(i).width()) + settings.slideMargin); + } + } + return w; + }; + plugin = { + doCss: function () { + var support = function () { + var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; + var root = document.documentElement; + for (var i = 0; i < transition.length; i++) { + if (transition[i] in root.style) { + return true; + } + } + }; + if (settings.useCSS && support()) { + return true; + } + return false; + }, + keyPress: function () { + if (settings.keyPress) { + $(document).on('keyup.lightslider', function (e) { + if (!$(':focus').is('input, textarea')) { + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + if (e.keyCode === 37) { + $el.goToPrevSlide(); + } else if (e.keyCode === 39) { + $el.goToNextSlide(); + } + } + }); + } + }, + controls: function () { + if (settings.controls) { + $el.after('
    ' + settings.prevHtml + '' + settings.nextHtml + '
    '); + if (!settings.autoWidth) { + if (length <= settings.item) { + $slide.find('.lSAction').hide(); + } + } else { + if (refresh.calWidth(false) < elSize) { + $slide.find('.lSAction').hide(); + } + } + $slide.find('.lSAction a').on('click', function (e) { + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + if ($(this).attr('class') === 'lSPrev') { + $el.goToPrevSlide(); + } else { + $el.goToNextSlide(); + } + return false; + }); + } + }, + initialStyle: function () { + var $this = this; + if (settings.mode === 'fade') { + settings.autoWidth = false; + settings.slideEndAnimation = false; + } + if (settings.auto) { + settings.slideEndAnimation = false; + } + if (settings.autoWidth) { + settings.slideMove = 1; + settings.item = 1; + } + if (settings.loop) { + settings.slideMove = 1; + settings.freeMove = false; + } + settings.onBeforeStart.call(this, $el); + refresh.chbreakpoint(); + $el.addClass('lightSlider').wrap('
    '); + $slide = $el.parent('.lSSlideWrapper'); + if (settings.rtl === true) { + $slide.parent().addClass('lSrtl'); + } + if (settings.vertical) { + $slide.parent().addClass('vertical'); + elSize = settings.verticalHeight; + $slide.css('height', elSize + 'px'); + } else { + elSize = $el.outerWidth(); + } + $children.addClass('lslide'); + if (settings.loop === true && settings.mode === 'slide') { + refresh.calSW(); + refresh.clone = function () { + if (refresh.calWidth(true) > elSize) { + /**/ + var tWr = 0, + tI = 0; + for (var k = 0; k < $children.length; k++) { + tWr += (parseInt($el.find('.lslide').eq(k).width()) + settings.slideMargin); + tI++; + if (tWr >= (elSize + settings.slideMargin)) { + break; + } + } + var tItem = settings.autoWidth === true ? tI : settings.item; + + /**/ + if (tItem < $el.find('.clone.left').length) { + for (var i = 0; i < $el.find('.clone.left').length - tItem; i++) { + $children.eq(i).remove(); + } + } + if (tItem < $el.find('.clone.right').length) { + for (var j = $children.length - 1; j > ($children.length - 1 - $el.find('.clone.right').length); j--) { + scene--; + $children.eq(j).remove(); + } + } + /**/ + for (var n = $el.find('.clone.right').length; n < tItem; n++) { + $el.find('.lslide').eq(n).clone().removeClass('lslide').addClass('clone right').appendTo($el); + scene++; + } + for (var m = $el.find('.lslide').length - $el.find('.clone.left').length; m > ($el.find('.lslide').length - tItem); m--) { + $el.find('.lslide').eq(m - 1).clone().removeClass('lslide').addClass('clone left').prependTo($el); + } + $children = $el.children(); + } else { + if ($children.hasClass('clone')) { + $el.find('.clone').remove(); + $this.move($el, 0); + } + } + }; + refresh.clone(); + } + refresh.sSW = function () { + length = $children.length; + if (settings.rtl === true && settings.vertical === false) { + gutter = 'margin-left'; + } + if (settings.autoWidth === false) { + $children.css(property, slideWidth + 'px'); + } + $children.css(gutter, settings.slideMargin + 'px'); + w = refresh.calWidth(false); + $el.css(property, w + 'px'); + if (settings.loop === true && settings.mode === 'slide') { + if (on === false) { + scene = $el.find('.clone.left').length; + } + } + }; + refresh.calL = function () { + $children = $el.children(); + length = $children.length; + }; + if (this.doCss()) { + $slide.addClass('usingCss'); + } + refresh.calL(); + if (settings.mode === 'slide') { + refresh.calSW(); + refresh.sSW(); + if (settings.loop === true) { + slideValue = $this.slideValue(); + this.move($el, slideValue); + } + if (settings.vertical === false) { + this.setHeight($el, false); + } + + } else { + this.setHeight($el, true); + $el.addClass('lSFade'); + if (!this.doCss()) { + $children.fadeOut(0); + $children.eq(scene).fadeIn(0); + } + } + if (settings.loop === true && settings.mode === 'slide') { + $children.eq(scene).addClass('active'); + } else { + $children.first().addClass('active'); + } + }, + pager: function () { + var $this = this; + refresh.createPager = function () { + thumbWidth = (elSize - ((settings.thumbItem * (settings.thumbMargin)) - settings.thumbMargin)) / settings.thumbItem; + var $children = $slide.find('.lslide'); + var length = $slide.find('.lslide').length; + var i = 0, + pagers = '', + v = 0; + for (i = 0; i < length; i++) { + if (settings.mode === 'slide') { + // calculate scene * slide value + if (!settings.autoWidth) { + v = i * ((slideWidth + settings.slideMargin) * settings.slideMove); + } else { + v += ((parseInt($children.eq(i).width()) + settings.slideMargin) * settings.slideMove); + } + } + var thumb = $children.eq(i * settings.slideMove).attr('data-thumb'); + if (settings.gallery === true) { + pagers += '
  • '; + } else { + pagers += '
  • ' + (i + 1) + '
  • '; + } + if (settings.mode === 'slide') { + if ((v) >= w - elSize - settings.slideMargin) { + i = i + 1; + var minPgr = 2; + if (settings.autoWidth) { + pagers += '
  • ' + (i + 1) + '
  • '; + minPgr = 1; + } + if (i < minPgr) { + pagers = null; + $slide.parent().addClass('noPager'); + } else { + $slide.parent().removeClass('noPager'); + } + break; + } + } + } + var $cSouter = $slide.parent(); + $cSouter.find('.lSPager').html(pagers); + if (settings.gallery === true) { + if (settings.vertical === true) { + // set Gallery thumbnail width + $cSouter.find('.lSPager').css('width', settings.vThumbWidth + 'px'); + } + pagerWidth = (i * (settings.thumbMargin + thumbWidth)) + 0.5; + $cSouter.find('.lSPager').css({ + property: pagerWidth + 'px', + 'transition-duration': settings.speed + 'ms' + }); + if (settings.vertical === true) { + $slide.parent().css('padding-right', (settings.vThumbWidth + settings.galleryMargin) + 'px'); + } + $cSouter.find('.lSPager').css(property, pagerWidth + 'px'); + } + var $pager = $cSouter.find('.lSPager').find('li'); + $pager.first().addClass('active'); + $pager.on('click', function () { + if (settings.loop === true && settings.mode === 'slide') { + scene = scene + ($pager.index(this) - $cSouter.find('.lSPager').find('li.active').index()); + } else { + scene = $pager.index(this); + } + $el.mode(false); + if (settings.gallery === true) { + $this.slideThumb(); + } + return false; + }); + }; + if (settings.pager) { + var cl = 'lSpg'; + if (settings.gallery) { + cl = 'lSGallery'; + } + $slide.after(''); + var gMargin = (settings.vertical) ? 'margin-left' : 'margin-top'; + $slide.parent().find('.lSPager').css(gMargin, settings.galleryMargin + 'px'); + refresh.createPager(); + } + + setTimeout(function () { + refresh.init(); + }, 0); + }, + setHeight: function (ob, fade) { + var obj = null, + $this = this; + if (settings.loop) { + obj = ob.children('.lslide ').first(); + } else { + obj = ob.children().first(); + } + var setCss = function () { + var tH = obj.outerHeight(), + tP = 0, + tHT = tH; + if (fade) { + tH = 0; + tP = ((tHT) * 100) / elSize; + } + ob.css({ + 'height': tH + 'px', + 'padding-bottom': tP + '%' + }); + }; + setCss(); + if (obj.find('img').length) { + if ( obj.find('img')[0].complete) { + setCss(); + if (!interval) { + $this.auto(); + } + }else{ + obj.find('img').load(function () { + setTimeout(function () { + setCss(); + if (!interval) { + $this.auto(); + } + }, 100); + }); + } + }else{ + if (!interval) { + $this.auto(); + } + } + }, + active: function (ob, t) { + if (this.doCss() && settings.mode === 'fade') { + $slide.addClass('on'); + } + var sc = 0; + if (scene * settings.slideMove < length) { + ob.removeClass('active'); + if (!this.doCss() && settings.mode === 'fade' && t === false) { + ob.fadeOut(settings.speed); + } + if (t === true) { + sc = scene; + } else { + sc = scene * settings.slideMove; + } + //t === true ? sc = scene : sc = scene * settings.slideMove; + var l, nl; + if (t === true) { + l = ob.length; + nl = l - 1; + if (sc + 1 >= l) { + sc = nl; + } + } + if (settings.loop === true && settings.mode === 'slide') { + //t === true ? sc = scene - $el.find('.clone.left').length : sc = scene * settings.slideMove; + if (t === true) { + sc = scene - $el.find('.clone.left').length; + } else { + sc = scene * settings.slideMove; + } + if (t === true) { + l = ob.length; + nl = l - 1; + if (sc + 1 === l) { + sc = nl; + } else if (sc + 1 > l) { + sc = 0; + } + } + } + + if (!this.doCss() && settings.mode === 'fade' && t === false) { + ob.eq(sc).fadeIn(settings.speed); + } + ob.eq(sc).addClass('active'); + } else { + ob.removeClass('active'); + ob.eq(ob.length - 1).addClass('active'); + if (!this.doCss() && settings.mode === 'fade' && t === false) { + ob.fadeOut(settings.speed); + ob.eq(sc).fadeIn(settings.speed); + } + } + }, + move: function (ob, v) { + if (settings.rtl === true) { + v = -v; + } + if (this.doCss()) { + if (settings.vertical === true) { + ob.css({ + 'transform': 'translate3d(0px, ' + (-v) + 'px, 0px)', + '-webkit-transform': 'translate3d(0px, ' + (-v) + 'px, 0px)' + }); + } else { + ob.css({ + 'transform': 'translate3d(' + (-v) + 'px, 0px, 0px)', + '-webkit-transform': 'translate3d(' + (-v) + 'px, 0px, 0px)', + }); + } + } else { + if (settings.vertical === true) { + ob.css('position', 'relative').animate({ + top: -v + 'px' + }, settings.speed, settings.easing); + } else { + ob.css('position', 'relative').animate({ + left: -v + 'px' + }, settings.speed, settings.easing); + } + } + var $thumb = $slide.parent().find('.lSPager').find('li'); + this.active($thumb, true); + }, + fade: function () { + this.active($children, false); + var $thumb = $slide.parent().find('.lSPager').find('li'); + this.active($thumb, true); + }, + slide: function () { + var $this = this; + refresh.calSlide = function () { + if (w > elSize) { + slideValue = $this.slideValue(); + $this.active($children, false); + if ((slideValue) > w - elSize - settings.slideMargin) { + slideValue = w - elSize - settings.slideMargin; + } else if (slideValue < 0) { + slideValue = 0; + } + $this.move($el, slideValue); + if (settings.loop === true && settings.mode === 'slide') { + if (scene >= (length - ($el.find('.clone.left').length / settings.slideMove))) { + $this.resetSlide($el.find('.clone.left').length); + } + if (scene === 0) { + $this.resetSlide($slide.find('.lslide').length); + } + } + } + }; + refresh.calSlide(); + }, + resetSlide: function (s) { + var $this = this; + $slide.find('.lSAction a').addClass('disabled'); + setTimeout(function () { + scene = s; + $slide.css('transition-duration', '0ms'); + slideValue = $this.slideValue(); + $this.active($children, false); + plugin.move($el, slideValue); + setTimeout(function () { + $slide.css('transition-duration', settings.speed + 'ms'); + $slide.find('.lSAction a').removeClass('disabled'); + }, 50); + }, settings.speed + 100); + }, + slideValue: function () { + var _sV = 0; + if (settings.autoWidth === false) { + _sV = scene * ((slideWidth + settings.slideMargin) * settings.slideMove); + } else { + _sV = 0; + for (var i = 0; i < scene; i++) { + _sV += (parseInt($children.eq(i).width()) + settings.slideMargin); + } + } + return _sV; + }, + slideThumb: function () { + var position; + switch (settings.currentPagerPosition) { + case 'left': + position = 0; + break; + case 'middle': + position = (elSize / 2) - (thumbWidth / 2); + break; + case 'right': + position = elSize - thumbWidth; + } + var sc = scene - $el.find('.clone.left').length; + var $pager = $slide.parent().find('.lSPager'); + if (settings.mode === 'slide' && settings.loop === true) { + if (sc >= $pager.children().length) { + sc = 0; + } else if (sc < 0) { + sc = $pager.children().length; + } + } + var thumbSlide = sc * ((thumbWidth + settings.thumbMargin)) - (position); + if ((thumbSlide + elSize) > pagerWidth) { + thumbSlide = pagerWidth - elSize - settings.thumbMargin; + } + if (thumbSlide < 0) { + thumbSlide = 0; + } + this.move($pager, thumbSlide); + }, + auto: function () { + if (settings.auto) { + clearInterval(interval); + interval = setInterval(function () { + $el.goToNextSlide(); + }, settings.pause); + } + }, + pauseOnHover: function(){ + var $this = this; + if (settings.auto && settings.pauseOnHover) { + $slide.on('mouseenter', function(){ + $(this).addClass('ls-hover'); + $el.pause(); + settings.auto = true; + }); + $slide.on('mouseleave',function(){ + $(this).removeClass('ls-hover'); + if (!$slide.find('.lightSlider').hasClass('lsGrabbing')) { + $this.auto(); + } + }); + } + }, + touchMove: function (endCoords, startCoords) { + $slide.css('transition-duration', '0ms'); + if (settings.mode === 'slide') { + var distance = endCoords - startCoords; + var swipeVal = slideValue - distance; + if ((swipeVal) >= w - elSize - settings.slideMargin) { + if (settings.freeMove === false) { + swipeVal = w - elSize - settings.slideMargin; + } else { + var swipeValT = w - elSize - settings.slideMargin; + swipeVal = swipeValT + ((swipeVal - swipeValT) / 5); + + } + } else if (swipeVal < 0) { + if (settings.freeMove === false) { + swipeVal = 0; + } else { + swipeVal = swipeVal / 5; + } + } + this.move($el, swipeVal); + } + }, + + touchEnd: function (distance) { + $slide.css('transition-duration', settings.speed + 'ms'); + if (settings.mode === 'slide') { + var mxVal = false; + var _next = true; + slideValue = slideValue - distance; + if ((slideValue) > w - elSize - settings.slideMargin) { + slideValue = w - elSize - settings.slideMargin; + if (settings.autoWidth === false) { + mxVal = true; + } + } else if (slideValue < 0) { + slideValue = 0; + } + var gC = function (next) { + var ad = 0; + if (!mxVal) { + if (next) { + ad = 1; + } + } + if (!settings.autoWidth) { + var num = slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove); + scene = parseInt(num) + ad; + if (slideValue >= (w - elSize - settings.slideMargin)) { + if (num % 1 !== 0) { + scene++; + } + } + } else { + var tW = 0; + for (var i = 0; i < $children.length; i++) { + tW += (parseInt($children.eq(i).width()) + settings.slideMargin); + scene = i + ad; + if (tW >= slideValue) { + break; + } + } + } + }; + if (distance >= settings.swipeThreshold) { + gC(false); + _next = false; + } else if (distance <= -settings.swipeThreshold) { + gC(true); + _next = false; + } + $el.mode(_next); + this.slideThumb(); + } else { + if (distance >= settings.swipeThreshold) { + $el.goToPrevSlide(); + } else if (distance <= -settings.swipeThreshold) { + $el.goToNextSlide(); + } + } + }, + + + + enableDrag: function () { + var $this = this; + if (!isTouch) { + var startCoords = 0, + endCoords = 0, + isDraging = false; + $slide.find('.lightSlider').addClass('lsGrab'); + $slide.on('mousedown', function (e) { + if (w < elSize) { + if (w !== 0) { + return false; + } + } + if ($(e.target).attr('class') !== ('lSPrev') && $(e.target).attr('class') !== ('lSNext')) { + startCoords = (settings.vertical === true) ? e.pageY : e.pageX; + isDraging = true; + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 + $slide.scrollLeft += 1; + $slide.scrollLeft -= 1; + // * + $slide.find('.lightSlider').removeClass('lsGrab').addClass('lsGrabbing'); + clearInterval(interval); + } + }); + $(window).on('mousemove', function (e) { + if (isDraging) { + endCoords = (settings.vertical === true) ? e.pageY : e.pageX; + $this.touchMove(endCoords, startCoords); + } + }); + $(window).on('mouseup', function (e) { + if (isDraging) { + $slide.find('.lightSlider').removeClass('lsGrabbing').addClass('lsGrab'); + isDraging = false; + endCoords = (settings.vertical === true) ? e.pageY : e.pageX; + var distance = endCoords - startCoords; + if (Math.abs(distance) >= settings.swipeThreshold) { + $(window).on('click.ls', function (e) { + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + e.stopImmediatePropagation(); + e.stopPropagation(); + $(window).off('click.ls'); + }); + } + + $this.touchEnd(distance); + + } + }); + } + }, + + + + + enableTouch: function () { + var $this = this; + if (isTouch) { + var startCoords = {}, + endCoords = {}; + $slide.on('touchstart', function (e) { + endCoords = e.originalEvent.targetTouches[0]; + startCoords.pageX = e.originalEvent.targetTouches[0].pageX; + startCoords.pageY = e.originalEvent.targetTouches[0].pageY; + clearInterval(interval); + }); + $slide.on('touchmove', function (e) { + if (w < elSize) { + if (w !== 0) { + return false; + } + } + var orig = e.originalEvent; + endCoords = orig.targetTouches[0]; + var xMovement = Math.abs(endCoords.pageX - startCoords.pageX); + var yMovement = Math.abs(endCoords.pageY - startCoords.pageY); + if (settings.vertical === true) { + if ((yMovement * 3) > xMovement) { + e.preventDefault(); + } + $this.touchMove(endCoords.pageY, startCoords.pageY); + } else { + if ((xMovement * 3) > yMovement) { + e.preventDefault(); + } + $this.touchMove(endCoords.pageX, startCoords.pageX); + } + + }); + $slide.on('touchend', function () { + if (w < elSize) { + if (w !== 0) { + return false; + } + } + var distance; + if (settings.vertical === true) { + distance = endCoords.pageY - startCoords.pageY; + } else { + distance = endCoords.pageX - startCoords.pageX; + } + $this.touchEnd(distance); + }); + } + }, + build: function () { + var $this = this; + $this.initialStyle(); + if (this.doCss()) { + + if (settings.enableTouch === true) { + $this.enableTouch(); + } + if (settings.enableDrag === true) { + $this.enableDrag(); + } + } + + $(window).on('focus', function(){ + $this.auto(); + }); + + $(window).on('blur', function(){ + clearInterval(interval); + }); + + $this.pager(); + $this.pauseOnHover(); + $this.controls(); + $this.keyPress(); + } + }; + plugin.build(); + refresh.init = function () { + refresh.chbreakpoint(); + if (settings.vertical === true) { + if (settings.item > 1) { + elSize = settings.verticalHeight; + } else { + elSize = $children.outerHeight(); + } + $slide.css('height', elSize + 'px'); + } else { + elSize = $slide.outerWidth(); + } + if (settings.loop === true && settings.mode === 'slide') { + refresh.clone(); + } + refresh.calL(); + if (settings.mode === 'slide') { + $el.removeClass('lSSlide'); + } + if (settings.mode === 'slide') { + refresh.calSW(); + refresh.sSW(); + } + setTimeout(function () { + if (settings.mode === 'slide') { + $el.addClass('lSSlide'); + } + }, 1000); + if (settings.pager) { + refresh.createPager(); + } + if (settings.adaptiveHeight === true && settings.vertical === false) { + $el.css('height', $children.eq(scene).outerHeight(true)); + } + if (settings.adaptiveHeight === false) { + if (settings.mode === 'slide') { + if (settings.vertical === false) { + plugin.setHeight($el, false); + }else{ + plugin.auto(); + } + } else { + plugin.setHeight($el, true); + } + } + if (settings.gallery === true) { + plugin.slideThumb(); + } + if (settings.mode === 'slide') { + plugin.slide(); + } + if (settings.autoWidth === false) { + if ($children.length <= settings.item) { + $slide.find('.lSAction').hide(); + } else { + $slide.find('.lSAction').show(); + } + } else { + if ((refresh.calWidth(false) < elSize) && (w !== 0)) { + $slide.find('.lSAction').hide(); + } else { + $slide.find('.lSAction').show(); + } + } + }; + $el.goToPrevSlide = function () { + if (scene > 0) { + settings.onBeforePrevSlide.call(this, $el, scene); + scene--; + $el.mode(false); + if (settings.gallery === true) { + plugin.slideThumb(); + } + } else { + if (settings.loop === true) { + settings.onBeforePrevSlide.call(this, $el, scene); + if (settings.mode === 'fade') { + var l = (length - 1); + scene = parseInt(l / settings.slideMove); + } + $el.mode(false); + if (settings.gallery === true) { + plugin.slideThumb(); + } + } else if (settings.slideEndAnimation === true) { + $el.addClass('leftEnd'); + setTimeout(function () { + $el.removeClass('leftEnd'); + }, 400); + } + } + }; + $el.goToNextSlide = function () { + var nextI = true; + if (settings.mode === 'slide') { + var _slideValue = plugin.slideValue(); + nextI = _slideValue < w - elSize - settings.slideMargin; + } + if (((scene * settings.slideMove) < length - settings.slideMove) && nextI) { + settings.onBeforeNextSlide.call(this, $el, scene); + scene++; + $el.mode(false); + if (settings.gallery === true) { + plugin.slideThumb(); + } + } else { + if (settings.loop === true) { + settings.onBeforeNextSlide.call(this, $el, scene); + scene = 0; + $el.mode(false); + if (settings.gallery === true) { + plugin.slideThumb(); + } + } else if (settings.slideEndAnimation === true) { + $el.addClass('rightEnd'); + setTimeout(function () { + $el.removeClass('rightEnd'); + }, 400); + } + } + }; + $el.mode = function (_touch) { + if (settings.adaptiveHeight === true && settings.vertical === false) { + $el.css('height', $children.eq(scene).outerHeight(true)); + } + if (on === false) { + if (settings.mode === 'slide') { + if (plugin.doCss()) { + $el.addClass('lSSlide'); + if (settings.speed !== '') { + $slide.css('transition-duration', settings.speed + 'ms'); + } + if (settings.cssEasing !== '') { + $slide.css('transition-timing-function', settings.cssEasing); + } + } + } else { + if (plugin.doCss()) { + if (settings.speed !== '') { + $el.css('transition-duration', settings.speed + 'ms'); + } + if (settings.cssEasing !== '') { + $el.css('transition-timing-function', settings.cssEasing); + } + } + } + } + if (!_touch) { + settings.onBeforeSlide.call(this, $el, scene); + } + if (settings.mode === 'slide') { + plugin.slide(); + } else { + plugin.fade(); + } + if (!$slide.hasClass('ls-hover')) { + plugin.auto(); + } + setTimeout(function () { + if (!_touch) { + settings.onAfterSlide.call(this, $el, scene); + } + }, settings.speed); + on = true; + }; + $el.play = function () { + $el.goToNextSlide(); + settings.auto = true; + plugin.auto(); + }; + $el.pause = function () { + settings.auto = false; + clearInterval(interval); + }; + $el.refresh = function () { + refresh.init(); + }; + $el.getCurrentSlideCount = function () { + var sc = scene; + if (settings.loop) { + var ln = $slide.find('.lslide').length, + cl = $el.find('.clone.left').length; + if (scene <= cl - 1) { + sc = ln + (scene - cl); + } else if (scene >= (ln + cl)) { + sc = scene - ln - cl; + } else { + sc = scene - cl; + } + } + return sc + 1; + }; + $el.getTotalSlideCount = function () { + return $slide.find('.lslide').length; + }; + $el.goToSlide = function (s) { + if (settings.loop) { + scene = (s + $el.find('.clone.left').length - 1); + } else { + scene = s; + } + $el.mode(false); + if (settings.gallery === true) { + plugin.slideThumb(); + } + }; + $el.destroy = function () { + if ($el.lightSlider) { + $el.goToPrevSlide = function(){}; + $el.goToNextSlide = function(){}; + $el.mode = function(){}; + $el.play = function(){}; + $el.pause = function(){}; + $el.refresh = function(){}; + $el.getCurrentSlideCount = function(){}; + $el.getTotalSlideCount = function(){}; + $el.goToSlide = function(){}; + $el.lightSlider = null; + refresh = { + init : function(){} + }; + $el.parent().parent().find('.lSAction, .lSPager').remove(); + $el.removeClass('lightSlider lSFade lSSlide lsGrab lsGrabbing leftEnd right').removeAttr('style').unwrap().unwrap(); + $el.children().removeAttr('style'); + $children.removeClass('lslide active'); + $el.find('.clone').remove(); + $children = null; + interval = null; + on = false; + scene = 0; + } + + }; + setTimeout(function () { + settings.onSliderLoad.call(this, $el); + }, 10); + $(window).on('resize orientationchange', function (e) { + setTimeout(function () { + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + refresh.init(); + }, 200); + }); + return this; + }; +}(jQuery)); \ No newline at end of file diff --git a/app/festival/static/scss/index.scss b/app/festival/static/scss/index.scss index 4f7acfde..cdcc175a 100755 --- a/app/festival/static/scss/index.scss +++ b/app/festival/static/scss/index.scss @@ -61,7 +61,10 @@ 'components/embed-responsive'; - +/** + * _Project vendors + */ +@import 'vendors/lightslider'; /** @@ -70,4 +73,5 @@ @import 'modules/artist-card', 'modules/artist-detail', 'modules/event-card', + 'modules/hero-slider', 'modules/user'; \ No newline at end of file diff --git a/app/festival/static/scss/modules/hero-slider.scss b/app/festival/static/scss/modules/hero-slider.scss new file mode 100644 index 00000000..5b51b687 --- /dev/null +++ b/app/festival/static/scss/modules/hero-slider.scss @@ -0,0 +1,11 @@ +.hero__slider { + +} + +.hero__slider__item { + display: block; + width: 100%; + height: 500px; + background: $main_color no-repeat center; + background-size: cover; +} \ No newline at end of file diff --git a/app/festival/static/scss/vendors/_lightslider.scss b/app/festival/static/scss/vendors/_lightslider.scss new file mode 100755 index 00000000..61752fb3 --- /dev/null +++ b/app/festival/static/scss/vendors/_lightslider.scss @@ -0,0 +1,395 @@ +/* lightslider - v1.1.5 - 2015-10-31 +* https://github.com/sachinchoolur/lightslider +* Copyright (c) 2015 Sachin N; Licensed MIT */ +/*! lightslider - v1.1.3 - 2015-04-14 +* https://github.com/sachinchoolur/lightslider +* Copyright (c) 2015 Sachin N; Licensed MIT */ +/** /!!! core css Should not edit !!!/**/ + +.lSSlideOuter { + overflow: hidden; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none +} +.lightSlider:before, .lightSlider:after { + content: " "; + display: table; +} +.lightSlider { + overflow: hidden; + margin: 0; +} +.lSSlideWrapper { + max-width: 100%; + overflow: hidden; + position: relative; +} +.lSSlideWrapper > .lightSlider:after { + clear: both; +} +.lSSlideWrapper .lSSlide { + -webkit-transform: translate(0px, 0px); + -ms-transform: translate(0px, 0px); + transform: translate(0px, 0px); + -webkit-transition: all 1s; + -webkit-transition-property: -webkit-transform,height; + -moz-transition-property: -moz-transform,height; + transition-property: transform,height; + -webkit-transition-duration: inherit !important; + transition-duration: inherit !important; + -webkit-transition-timing-function: inherit !important; + transition-timing-function: inherit !important; +} +.lSSlideWrapper .lSFade { + position: relative; +} +.lSSlideWrapper .lSFade > * { + position: absolute !important; + top: 0; + left: 0; + z-index: 9; + margin-right: 0; + width: 100%; +} +.lSSlideWrapper.usingCss .lSFade > * { + opacity: 0; + -webkit-transition-delay: 0s; + transition-delay: 0s; + -webkit-transition-duration: inherit !important; + transition-duration: inherit !important; + -webkit-transition-property: opacity; + transition-property: opacity; + -webkit-transition-timing-function: inherit !important; + transition-timing-function: inherit !important; +} +.lSSlideWrapper .lSFade > *.active { + z-index: 10; +} +.lSSlideWrapper.usingCss .lSFade > *.active { + opacity: 1; +} +/** /!!! End of core css Should not edit !!!/**/ + +/* Pager */ +.lSSlideOuter .lSPager.lSpg { + margin: 10px 0 0; + padding: 0; + text-align: center; +} +.lSSlideOuter .lSPager.lSpg > li { + cursor: pointer; + display: inline-block; + padding: 0 5px; +} +.lSSlideOuter .lSPager.lSpg > li a { + background-color: #222222; + border-radius: 30px; + display: inline-block; + height: 8px; + overflow: hidden; + text-indent: -999em; + width: 8px; + position: relative; + z-index: 99; + -webkit-transition: all 0.5s linear 0s; + transition: all 0.5s linear 0s; +} +.lSSlideOuter .lSPager.lSpg > li:hover a, .lSSlideOuter .lSPager.lSpg > li.active a { + background-color: $main_color; +} +.lSSlideOuter .media { + opacity: 0.8; +} +.lSSlideOuter .media.active { + opacity: 1; +} +/* End of pager */ + +/** Gallery */ +.lSSlideOuter .lSPager.lSGallery { + list-style: none outside none; + padding-left: 0; + margin: 0; + overflow: hidden; + transform: translate3d(0px, 0px, 0px); + -moz-transform: translate3d(0px, 0px, 0px); + -ms-transform: translate3d(0px, 0px, 0px); + -webkit-transform: translate3d(0px, 0px, 0px); + -o-transform: translate3d(0px, 0px, 0px); + -webkit-transition-property: -webkit-transform; + -moz-transition-property: -moz-transform; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.lSSlideOuter .lSPager.lSGallery li { + overflow: hidden; + -webkit-transition: border-radius 0.12s linear 0s 0.35s linear 0s; + transition: border-radius 0.12s linear 0s 0.35s linear 0s; +} +.lSSlideOuter .lSPager.lSGallery li.active, .lSSlideOuter .lSPager.lSGallery li:hover { + border-radius: 5px; +} +.lSSlideOuter .lSPager.lSGallery img { + display: block; + height: auto; + max-width: 100%; +} +.lSSlideOuter .lSPager.lSGallery:before, .lSSlideOuter .lSPager.lSGallery:after { + content: " "; + display: table; +} +.lSSlideOuter .lSPager.lSGallery:after { + clear: both; +} +/* End of Gallery*/ + +/* slider actions */ +.lSAction > a { + width: 32px; + display: block; + top: 50%; + height: 32px; + background-image: url('../img/controls.png'); + cursor: pointer; + position: absolute; + z-index: 99; + margin-top: -16px; + opacity: 0.5; + -webkit-transition: opacity 0.35s linear 0s; + transition: opacity 0.35s linear 0s; +} +.lSAction > a:hover { + opacity: 1; +} +.lSAction > .lSPrev { + background-position: 0 0; + left: 10px; +} +.lSAction > .lSNext { + background-position: -32px 0; + right: 10px; +} +.lSAction > a.disabled { + pointer-events: none; +} +.cS-hidden { + height: 1px; + opacity: 0; + filter: alpha(opacity=0); + overflow: hidden; +} + + +/* vertical */ +.lSSlideOuter.vertical { + position: relative; +} +.lSSlideOuter.vertical.noPager { + padding-right: 0px !important; +} +.lSSlideOuter.vertical .lSGallery { + position: absolute !important; + right: 0; + top: 0; +} +.lSSlideOuter.vertical .lightSlider > * { + width: 100% !important; + max-width: none !important; +} + +/* vertical controlls */ +.lSSlideOuter.vertical .lSAction > a { + left: 50%; + margin-left: -14px; + margin-top: 0; +} +.lSSlideOuter.vertical .lSAction > .lSNext { + background-position: 31px -31px; + bottom: 10px; + top: auto; +} +.lSSlideOuter.vertical .lSAction > .lSPrev { + background-position: 0 -31px; + bottom: auto; + top: 10px; +} +/* vertical */ + + +/* Rtl */ +.lSSlideOuter.lSrtl { + direction: rtl; +} +.lSSlideOuter .lightSlider, .lSSlideOuter .lSPager { + padding-left: 0; + list-style: none outside none; +} +.lSSlideOuter.lSrtl .lightSlider, .lSSlideOuter.lSrtl .lSPager { + padding-right: 0; +} +.lSSlideOuter .lightSlider > *, .lSSlideOuter .lSGallery li { + float: left; +} +.lSSlideOuter.lSrtl .lightSlider > *, .lSSlideOuter.lSrtl .lSGallery li { + float: right !important; +} +/* Rtl */ + +@-webkit-keyframes rightEnd { + 0% { + left: 0; + } + + 50% { + left: -15px; + } + + 100% { + left: 0; + } +} +@keyframes rightEnd { + 0% { + left: 0; + } + + 50% { + left: -15px; + } + + 100% { + left: 0; + } +} +@-webkit-keyframes topEnd { + 0% { + top: 0; + } + + 50% { + top: -15px; + } + + 100% { + top: 0; + } +} +@keyframes topEnd { + 0% { + top: 0; + } + + 50% { + top: -15px; + } + + 100% { + top: 0; + } +} +@-webkit-keyframes leftEnd { + 0% { + left: 0; + } + + 50% { + left: 15px; + } + + 100% { + left: 0; + } +} +@keyframes leftEnd { + 0% { + left: 0; + } + + 50% { + left: 15px; + } + + 100% { + left: 0; + } +} +@-webkit-keyframes bottomEnd { + 0% { + bottom: 0; + } + + 50% { + bottom: -15px; + } + + 100% { + bottom: 0; + } +} +@keyframes bottomEnd { + 0% { + bottom: 0; + } + + 50% { + bottom: -15px; + } + + 100% { + bottom: 0; + } +} +.lSSlideOuter .rightEnd { + -webkit-animation: rightEnd 0.3s; + animation: rightEnd 0.3s; + position: relative; +} +.lSSlideOuter .leftEnd { + -webkit-animation: leftEnd 0.3s; + animation: leftEnd 0.3s; + position: relative; +} +.lSSlideOuter.vertical .rightEnd { + -webkit-animation: topEnd 0.3s; + animation: topEnd 0.3s; + position: relative; +} +.lSSlideOuter.vertical .leftEnd { + -webkit-animation: bottomEnd 0.3s; + animation: bottomEnd 0.3s; + position: relative; +} +.lSSlideOuter.lSrtl .rightEnd { + -webkit-animation: leftEnd 0.3s; + animation: leftEnd 0.3s; + position: relative; +} +.lSSlideOuter.lSrtl .leftEnd { + -webkit-animation: rightEnd 0.3s; + animation: rightEnd 0.3s; + position: relative; +} +/*/ GRab cursor */ +.lightSlider.lsGrab > * { + cursor: -webkit-grab; + cursor: -moz-grab; + cursor: -o-grab; + cursor: -ms-grab; + cursor: grab; +} +.lightSlider.lsGrabbing > * { + cursor: move; + cursor: -webkit-grabbing; + cursor: -moz-grabbing; + cursor: -o-grabbing; + cursor: -ms-grabbing; + cursor: grabbing; +} \ No newline at end of file diff --git a/app/templates/base.html b/app/templates/base.html index 94200a84..1b2b89ea 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -35,7 +35,7 @@
    - + Logo Manifeste 2016 ircam
    @@ -59,6 +59,23 @@ + {% if on_home %} +
    + +
    + {% endif %} +
    {% nevercache %} diff --git a/app/templates/includes/language_selector.html b/app/templates/includes/language_selector.html index e1597690..74845080 100644 --- a/app/templates/includes/language_selector.html +++ b/app/templates/includes/language_selector.html @@ -1,7 +1,7 @@ {% load i18n %} {% get_language_info_list for LANGUAGES as languages %} {% if settings.USE_MODELTRANSLATION and languages|length > 1 %} -
    +