/* DESTOON Copyright (C)2008-2099 www.destoon.com This is NOT a freeware,Use is subject to license.txt */ function Dslide(id, time) { if($('#'+id).length == 0) return; if($('#'+id).html().indexOf(''; for(var i = 0; i < this.max; i++) { this.htm += '
  • '; } this.htm += ''; if(this.alt[0]) this.htm += '
    '+this.alt[0]+'
    '; this.htm += '
    '; for(var i = 0; i < this.max; i++) { this.htm += ''; } this.htm += '
    '; $('#'+id).html(this.htm); if(this.max == 1) return; this.t; this.p = 0; $('#'+id).on('swipeleft',function(){ _this.slide(_this.c+1); }); $('#'+id).on('swiperight',function(){ _this.slide(_this.c-1); }); $('#'+id).on('touchstart',function(){ _this.p = 1; }); $('#'+id).on('touchend',function(){ _this.p = 0; }); $(window).bind('orientationchange.slide'+id, function(e){ window.setTimeout(function() { _this.w = document.body.clientWidth; $('#'+id).find('ul').css('width', _this.w*(_this.max+1)); $('#'+id).find('img').css('width', _this.w); $('#'+id).find('div').css('width', _this.w); _this.p = 0; }, 300); }); this.slide = function(o) { if(o == this.c) return; if(o < 0 || o >= this.max) return; if(o == 0 && this.c == this.max - 1) { $('#'+id+'_ul').append($('#'+id+'_ul li:first').clone()); $('#'+id+'_ul').stop(true, true).animate({'left':-this.w*this.max},500,function() { $('#'+id+'_ul').css('left','0'); $('#'+id+'_ul li:last').remove(); }); } else { $('#'+id+'_ul').stop(true, true).animate({'left':-o*this.w},500); } $('#'+id+'_no_'+this.c).css('background','#FFFFFF'); $('#'+id+'_no_'+o).css('background','#007AFF'); if(this.alt[0]) $('#'+id+'_alt').html(this.alt[o]); this.c = o; } this.start = function() { if(this.p) return; if(this.c == this.max - 1) { this.slide(0); } else { this.slide(this.c+1); } } this.t = setInterval(function() {_this.start();}, time); return true; }