can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r17588: LJSUP-7226: images are now displayed lef...

Committer: dpetrov
LJSUP-7226: images are now displayed left to right from old to new
U   trunk/htdocs/js/widgets/photos2homepage.js
Modified: trunk/htdocs/js/widgets/photos2homepage.js
===================================================================
--- trunk/htdocs/js/widgets/photos2homepage.js	2010-10-22 03:48:06 UTC (rev 17587)
+++ trunk/htdocs/js/widgets/photos2homepage.js	2010-10-22 04:04:48 UTC (rev 17588)
@@ -30,23 +30,28 @@
 	},
 
 	prev: function(){
-		if(this.page == 1) return;
-		this.page--;
+		if(this.page == this.pages) return;
+		this.page++;
 		this._updatePager();
 	},
 
 	next: function(){
-		if(this.page == this.pages) return;
-		this.page++;
+		if(this.page == 1) return;
+		this.page--;
 		this._updatePager();
 	},
 
 	_updatePager: function(){
 		this._updatePageButtons();
 
+		var baseIdx =  this.ppCount * this.page - 1;
+		if( baseIdx >= photos2homepage.length ) {
+			baseIdx = photos2homepage.length - 1;
+		}
+
 		var idx = 0;
 		for( var i = 0; i < this.ppCount; ++i ){
-			idx = i + this.ppCount * (this.page - 1);
+			idx = baseIdx - i;
 
 			if( idx < photos2homepage.length ){
 				this.images[ i ].img.src = this.imageHash[ idx ].src;
@@ -61,7 +66,7 @@
 	},
 
 	_updatePageButtons: function(){
-		this.controls.prev[(this.page == 1)?"addClass":"removeClass"]('i-potd-nav-prev-dis');
-		this.controls.next[(this.page == this.pages || !this.pages)?"addClass":"removeClass"]('i-potd-nav-next-dis');
+		this.controls.next[(this.page == 1)?"addClass":"removeClass"]('i-potd-nav-next-dis');
+		this.controls.prev[(this.page == this.pages || !this.pages)?"addClass":"removeClass"]('i-potd-nav-prev-dis');
 	}
 }

Tags: can3p, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments