Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

2.1

  • Loading branch information...
commit 25afa57be2ea705c30995d339bb286f3e2139cde 1 parent 245adc0
@pastawoua authored
View
16 demo/demo.html
@@ -124,27 +124,25 @@
</div>
<!-- Scripts -->
- <script type="text/javascript" src="libs/modernizr.custom.min.js"></script>
+ <script type="text/javascript" src="modernizr.custom.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="../jquery.wmuSlider.js"></script>
<script src="../jquery.wmuGallery.js"></script>
<script>
- $('.example1').wmuSlider({
- touch: Modernizr.touch
- });
+ $('.example1').wmuSlider();
+
$('.example2').wmuSlider({
- touch: Modernizr.touch,
+ touch: true,
animation: 'slide'
});
+
$('.example3').wmuSlider({
touch: Modernizr.touch,
animation: 'slide',
items: 2
});
- $('.example4').wmuGallery({
- touch: Modernizr.touch,
- items: 4
- });
+
+ $('.example4').wmuGallery();
</script>
<!-- END body -->
View
0  jquery.touchSwipe.min.js → demo/jquery.touchSwipe.min.js
File renamed without changes
View
0  demo/libs/modernizr.custom.min.js → demo/modernizr.custom.min.js
File renamed without changes
View
9 jquery.wmuSlider.min.js
@@ -0,0 +1,9 @@
+/*!
+ * jQuery wmuSlider v2.0
+ *
+ * Copyright (c) 2011 Brice Lechatellier
+ * http://brice.lechatellier.com/
+ *
+ * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
+ */
+(function(a){a.fn.wmuSlider=function(b){var c={animation:"fade",animationDuration:600,slideshow:true,slideshowSpeed:7000,slideToStart:0,navigationControl:true,paginationControl:true,previousText:"Previous",nextText:"Next",touch:false,slide:"article",items:1};var b=a.extend(c,b);return this.each(function(){var p=a(this);var o=b.slideToStart;var f=p.find(".wmuSliderWrapper");var g=p.find(b.slide);var d=g.length;var k;var l;var e;var j=function(t,u,v){if(e){return false}e=true;o=t;var s=a(g[t]);p.animate({height:s.innerHeight()});if(b.animation=="fade"){g.css({position:"absolute",opacity:0});s.css("position","relative");s.animate({opacity:1},b.animationDuration,function(){e=false})}else{if(b.animation=="slide"){if(!u){f.animate({marginLeft:-p.width()/b.items*t},b.animationDuration,function(){e=false})}else{if(t==0){f.animate({marginLeft:-p.width()/b.items*d},b.animationDuration,function(){f.css("marginLeft",0);e=false})}else{if(!v){f.css("marginLeft",-p.width()/b.items*d)}f.animate({marginLeft:-p.width()/b.items*t},b.animationDuration,function(){e=false})}}}}if(l){l.find("a").each(function(w){if(w==t){a(this).addClass("wmuActive")}else{a(this).removeClass("wmuActive")}})}p.trigger("slideLoaded",t)};if(b.navigationControl){var i=a('<a class="wmuSliderPrev">'+b.previousText+"</a>");i.click(function(s){s.preventDefault();clearTimeout(k);if(o==0){j(d-1,true)}else{j(o-1)}});p.append(i);var m=a('<a class="wmuSliderNext">'+b.nextText+"</a>");m.click(function(s){s.preventDefault();clearTimeout(k);if(o+1==d){j(0,true)}else{j(o+1)}});p.append(m)}if(b.paginationControl){l=a('<ul class="wmuSliderPagination"></ul>');a.each(g,function(s){l.append('<li><a href="#">'+s+"</a></li>");l.find("a:eq("+s+")").click(function(t){t.preventDefault();clearTimeout(k);j(s)})});p.append(l)}if(b.slideshow){var r=function(){if(o+1<d){j(o+1)}else{j(0,true)}k=setTimeout(r,b.slideshowSpeed)};k=setTimeout(r,b.slideshowSpeed)}var h=function(){var s=a(g[o]);p.animate({height:s.innerHeight()});if(b.animation=="slide"){g.css({width:p.width()/b.items});f.css({marginLeft:-p.width()/b.items*o,width:p.width()*g.length})}};var n=function(t,s,u,v){clearTimeout(k);if(s=="move"&&(u=="left"||u=="right")){if(u=="right"){if(o==0){f.css("marginLeft",(-d*p.width()/b.items)+v)}else{f.css("marginLeft",(-o*p.width()/b.items)+v)}}else{if(u=="left"){f.css("marginLeft",(-o*p.width()/b.items)-v)}}}else{if(s=="cancel"){if(u=="right"&&o==0){f.animate({marginLeft:-d*p.width()/b.items},b.animationDuration)}else{f.animate({marginLeft:-o*p.width()/b.items},b.animationDuration)}}else{if(s=="end"){if(u=="right"){if(o==0){j(d-1,true,true)}else{j(o-1)}}else{if(u=="left"){if(o+1==d){j(0,true)}else{j(o+1)}}else{f.animate({marginLeft:-o*p.width()/b.items},b.animationDuration)}}}}}};if(b.touch&&b.animation=="slide"){if(!a.isFunction(a.fn.swipe)){a.ajax({url:"jquery.touchSwipe.min.js",async:false})}if(a.isFunction(a.fn.swipe)){p.swipe({triggerOnTouchEnd:false,swipeStatus:n,allowPageScroll:"vertical"})}}var q=function(){var s=a(g[o]);var t=s.find("img");t.load(function(){f.show();p.animate({height:s.innerHeight()})});if(b.animation=="fade"){g.css({position:"absolute",width:"100%",opacity:0});a(g[o]).css("position","relative")}else{if(b.animation=="slide"){if(b.items>d){b.items=d}g.css("float","left");g.each(function(w){var v=a(this);v.attr("data-index",w)});for(var u=0;u<b.items;u++){f.append(a(g[u]).clone())}g=p.find(b.slide)}}h();p.trigger("hasLoaded");j(o)};q();a(window).resize(h);p.bind("loadSlide",function(t,s){clearTimeout(k);j(s)})})}})(jQuery);
View
23 jquery.wmuslider.js
@@ -1,5 +1,5 @@
/*!
- * jQuery wmuSlider v2.0
+ * jQuery wmuSlider v2.1
*
* Copyright (c) 2011 Brice Lechatellier
* http://brice.lechatellier.com/
@@ -42,6 +42,7 @@
var paginationControl;
var isAnimating;
+
/* Load Slide
================================================== */
var loadSlide = function(index, infinite, touch) {
@@ -51,7 +52,7 @@
isAnimating = true;
currentIndex = index;
var slide = $(slides[index]);
- $this.css('height', slide.innerHeight());
+ $this.animate({ height: slide.innerHeight() });
if (options.animation == 'fade') {
slides.css({
position: 'absolute',
@@ -162,7 +163,7 @@
================================================== */
var resize = function() {
var slide = $(slides[currentIndex]);
- $this.css('height', slide.innerHeight());
+ $this.animate({ height: slide.innerHeight() });
if (options.animation == 'slide') {
slides.css({
width: $this.width() / options.items
@@ -229,11 +230,11 @@
/* Init Slider
================================================== */
var init = function() {
- // Animation Setup
var slide = $(slides[currentIndex]);
var img = slide.find('img');
img.load(function() {
- $this.css('height', slide.innerHeight());
+ wrapper.show();
+ $this.animate({ height: slide.innerHeight() });
});
if (options.animation == 'fade') {
slides.css({
@@ -241,12 +242,12 @@
width: '100%',
opacity: 0
});
- $(slides[currentIndex]).css('position', 'relative')
- wrapper.show();
+ $(slides[currentIndex]).css('position', 'relative');
} else if (options.animation == 'slide') {
- slides.css({
- float: 'left',
- });
+ if (options.items > slidesCount) {
+ options.items = slidesCount;
+ }
+ slides.css('float', 'left');
slides.each(function(i){
var slide = $(this);
slide.attr('data-index', i);
@@ -255,8 +256,6 @@
wrapper.append($(slides[i]).clone());
}
slides = $this.find(options.slide);
-
- wrapper.show();
}
resize();

0 comments on commit 25afa57

Please sign in to comment.
Something went wrong with that request. Please try again.