Skip to content

Commit

Permalink
Merge pull request peachananr#76 from faygrin/faygrin_fix
Browse files Browse the repository at this point in the history
Fix error & refactor
  • Loading branch information
peachananr committed Jan 26, 2014
2 parents 3128d9e + 0ac1f28 commit 227cecc
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions jquery.onepage-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
var href = window.location.href.substr(0,window.location.href.indexOf('#')) + "#" + (index + 1);
history.pushState( {}, document.title, href );
}
el.transformPage(settings, pos, index);
el.transformPage(settings, pos, next.data("index"));
}

$.fn.moveUp = function() {
Expand Down Expand Up @@ -171,7 +171,7 @@
var href = window.location.href.substr(0,window.location.href.indexOf('#')) + "#" + (index - 1);
history.pushState( {}, document.title, href );
}
el.transformPage(settings, pos, index);
el.transformPage(settings, pos, next.data("index"));
}

$.fn.moveTo = function(page_index) {
Expand Down Expand Up @@ -299,21 +299,7 @@
if(settings.pagination == true) {
$(".onepage-pagination li a").click(function (){
var page_index = $(this).data("index");
if (!$(this).hasClass("active")) {
current = $(settings.sectionContainer + ".active")
next = $(settings.sectionContainer + "[data-index='" + (page_index) + "']");
if(next) {
current.removeClass("active")
next.addClass("active")
$(".onepage-pagination li a" + ".active").removeClass("active");
$(".onepage-pagination li a" + "[data-index='" + (page_index) + "']").addClass("active");
$("body")[0].className = $("body")[0].className.replace(/\bviewing-page-\d.*?\b/g, '');
$("body").addClass("viewing-page-"+next.data("index"))
}
pos = ((page_index - 1) * 100) * -1;
el.transformPage(settings, pos, page_index);
}
if (settings.updateURL == false) return false;
el.moveTo(page_index);
});
}

Expand Down

0 comments on commit 227cecc

Please sign in to comment.