iscroll实现图片的循环滑动

阅读更多
99特惠超低价 无限购
style="position:relative;width:320px;overflow:hidden;">
4.5
商品图片

     

     

     

    function loadedFor99TeHui(){

    	if(null!=document.getElementById("index-splash-block1")){
    		pullDownEl_99 = document.getElementById('pullDown_99');
    		pullUpEl_99 = document.getElementById('pullUp_99');
    		pullDownOffset_99 = pullDownEl_99.offsetHeight;
    		pullUpOffset_99 = pullUpEl_99.offsetHeight;
    		myScroll_99TeHui = new iScroll('index-splash-block1', {
    					snap: true,
    					momentum: false,
    					hScrollbar: false,					
    					checkDOMChanges:true,
    					onRefresh: function () {
    						if (pullDownEl_99.className.match('loading')) {
    							pullDownEl_99.className = '';
    						} else if (pullUpEl_99.className.match('loading')) {
    							pullUpEl_99.className = '';
    						}
    					},
    					onScrollMove: function () {
    						if (this.x > 5 && !pullDownEl_99.className.match('flip')) {
    							pullDownEl_99.className = 'flip';
    							this.minScrollX = 0;
    						} else if (this.x < 5 && pullDownEl_99.className.match('flip')) {
    							pullDownEl_99.className = '';
    							this.minScrollX = -pullDownOffset_99;
    						} else if (this.x < (this.maxScrollX - 5) && !pullUpEl_99.className.match('flip')) {
    							pullUpEl_99.className = 'flip';
    							this.maxScrollX = this.maxScrollX;
    						} else if (this.x > (this.maxScrollX + 5) && pullUpEl_99.className.match('flip')) {
    							pullUpEl_99.className = '';
    							this.maxScrollX = pullUpOffset_99;
    						}
    					},
    					onScrollEnd: function () {
    						document.querySelector('#feature-slide-list-items1 > a.current').className = '';
    						document.querySelector('#feature-slide-list-items1 > a:nth-child(' + (this.currPageX+1) + ')').className = 'current';
    						var	count=document.querySelectorAll("#feature-slide-list-items1 > a").length;
    						if (pullDownEl_99.className.match('flip')) {
    							pullDownEl_99.className = 'loading';
    							scrollDirection(this,'next',count);		
    						} else if (pullUpEl_99.className.match('flip')) {
    							pullUpEl_99.className = 'loading';							
    							scrollDirection(this,'prev',count);							
    						}
    					}
    				 });
    				 }
    		
    }
    
    document.addEventListener('DOMContentLoaded',setTimeout(loadedFor99TeHui,100),false);

    你可能感兴趣的:(iscroll实现图片的循环滑动)