(function( window, $, undefined ) { // http://www.netcu.de/jquery-touchwipe-iphone-ipad-library $.fn.touchwipe = function(settings) { var config = { min_move_x: 20, min_move_y: 20, wipeleft: function() { }, wiperight: function() { }, wipeup: function() { }, wipedown: function() { }, preventdefaultevents: true }; if (settings) $.extend(config, settings); this.each(function() { var startx; var starty; var ismoving = false; function canceltouch() { this.removeeventlistener('touchmove', ontouchmove); startx = null; ismoving = false; } function ontouchmove(e) { if(config.preventdefaultevents) { e.preventdefault(); } if(ismoving) { var x = e.touches[0].pagex; var y = e.touches[0].pagey; var dx = startx - x; var dy = starty - y; if(math.abs(dx) >= config.min_move_x) { canceltouch(); if(dx > 0) { config.wipeleft(); } else { config.wiperight(); } } else if(math.abs(dy) >= config.min_move_y) { canceltouch(); if(dy > 0) { config.wipedown(); } else { config.wipeup(); } } } } function ontouchstart(e) { if (e.touches.length == 1) { startx = e.touches[0].pagex; starty = e.touches[0].pagey; ismoving = true; this.addeventlistener('touchmove', ontouchmove, false); } } if ('ontouchstart' in document.documentelement) { this.addeventlistener('touchstart', ontouchstart, false); } }); return this; }; $.elastislide = function( options, element ) { this.$el = $( element ); this._init( options ); }; $.elastislide.defaults = { speed : 450, // animation speed easing : '', // animation easing effect imagew : 190, // the images width margin : 30, // image margin right border : 0, // image border minitems : 1, // the minimum number of items to show. // when we resize the window, this will make sure minitems are always shown // (unless of course minitems is higher than the total number of elements) current : 0, // index of the current item // when we resize the window, the carousel will make sure this item is visible onclick : function() { return false; } // click item callback }; $.elastislide.prototype = { _init : function( options ) { this.options = $.extend( true, {}, $.elastislide.defaults, options ); //