这是indexloc提供的服务,不要输入任何密码
Skip to content
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;
}

}
}