Skip to content
This repository was archived by the owner on Dec 26, 2023. It is now read-only.

Commit 783527a

Browse files
author
Mobius1
committed
v0.5.4
1 parent 5ddd3ae commit 783527a

File tree

4 files changed

+37
-35
lines changed

4 files changed

+37
-35
lines changed

dist/pageable.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pageable.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pageable",
3-
"version": "0.5.3",
3+
"version": "0.5.4",
44
"description": "Create full page scrolling web pages. No jQuery.",
55
"main": "dist/pageable.js",
66
"scripts": {

src/index.js

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import SlideShow from "./classes/slideshow";
22
import Emitter from "./classes/emitter";
33

44
/**
5-
* Pageable 0.5.3
5+
* Pageable 0.5.4
66
*
77
* https://github.com/Mobius1/Pageable
88
* Released under the MIT license
@@ -208,7 +208,7 @@ export default class Pageable extends Emitter {
208208
this.config.onInit.call(this, data);
209209

210210
// emit "init" event
211-
this.emit("init", data);
211+
this.emit("init", data);
212212

213213
this.initialised = true;
214214
this.container.pageable = this;
@@ -531,7 +531,7 @@ export default class Pageable extends Emitter {
531531
}
532532

533533
this.initialised = false;
534-
delete this.container.pageable;
534+
delete this.container.pageable;
535535
}
536536
}
537537

@@ -966,34 +966,36 @@ export default class Pageable extends Emitter {
966966
t
967967
);
968968
}
969-
970-
_toggleInfinite(destroy) {
971-
if ( destroy ) {
972-
for (const clone of this.clones) {
973-
this.container.removeChild(clone);
974-
}
975-
this.config.infinite = false;
976-
} else {
977-
this.config.infinite = true;
978-
979-
const first = this.pages[0].cloneNode(true);
980-
const last = this.pages[this.lastIndex].cloneNode(true);
981-
982-
first.id = `${first.id}-clone`;
983-
last.id = `${last.id}-clone`;
984-
985-
first.classList.add("pg-clone");
986-
last.classList.add("pg-clone");
987-
988-
first.classList.remove("pg-active");
989-
last.classList.remove("pg-active");
990-
991-
this.clones = [first, last];
992-
993-
this.container.insertBefore(last, this.pages[0]);
994-
this.container.appendChild(first);
995-
}
996-
}
969+
970+
_toggleInfinite(destroy) {
971+
if (destroy && this.config.infinite) {
972+
for (const clone of this.clones) {
973+
this.container.removeChild(clone);
974+
}
975+
this.config.infinite = false;
976+
} else if (!this.config.infinite) {
977+
this.config.infinite = true;
978+
979+
const first = this.pages[0].cloneNode(true);
980+
const last = this.pages[this.lastIndex].cloneNode(true);
981+
982+
first.id = `${first.id}-clone`;
983+
last.id = `${last.id}-clone`;
984+
985+
first.classList.add("pg-clone");
986+
last.classList.add("pg-clone");
987+
988+
first.classList.remove("pg-active");
989+
last.classList.remove("pg-active");
990+
991+
this.clones = [first, last];
992+
993+
this.container.insertBefore(last, this.pages[0]);
994+
this.container.appendChild(first);
995+
}
996+
997+
this.update();
998+
}
997999

9981000
/**
9991001
* Limit dragging / swiping

0 commit comments

Comments
 (0)