Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoiding conflicts #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions css/pageslider.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
transform: translate3d(0, 0, 0);
}

.page.left {
.page.pos_left {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}

.page.center {
.page.pos_center {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}

.page.right {
.page.pos_right {
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}

.page.transition {
-webkit-transition-duration: .25s;
transition-duration: .25s;
}
}
12 changes: 6 additions & 6 deletions pageslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ function PageSlider(container) {
}
if (state === stateHistory[l-2]) {
stateHistory.pop();
this.slidePageFrom(page, 'left');
this.slidePageFrom(page, 'pos_left');
} else {
stateHistory.push(state);
this.slidePageFrom(page, 'right');
this.slidePageFrom(page, 'pos_right');
}

}
Expand All @@ -36,7 +36,7 @@ function PageSlider(container) {
container.append(page);

if (!currentPage || !from) {
page.attr("class", "page center");
page.attr("class", "page pos_center");
currentPage = page;
return;
}
Expand All @@ -52,9 +52,9 @@ function PageSlider(container) {
container[0].offsetWidth;

// Position the new page and the current page at the ending position of their animation with a transition class indicating the duration of the animation
page.attr("class", "page transition center");
currentPage.attr("class", "page transition " + (from === "left" ? "right" : "left"));
page.attr("class", "page transition pos_center");
currentPage.attr("class", "page transition " + (from === "pos_left" ? "pos_right" : "pos_left"));
currentPage = page;
}

}
}