|
@@ -1,7 +1,7 @@
|
|
class Thumbnails {
|
|
class Thumbnails {
|
|
constructor (options) {
|
|
constructor (options) {
|
|
this.container = options.container;
|
|
this.container = options.container;
|
|
- this.barWidth = options.barWidth;
|
|
|
|
|
|
+ this.barWrap = options.barWrap;
|
|
this.container.style.backgroundImage = `url('${options.url}')`;
|
|
this.container.style.backgroundImage = `url('${options.url}')`;
|
|
this.events = options.events;
|
|
this.events = options.events;
|
|
}
|
|
}
|
|
@@ -18,8 +18,8 @@ class Thumbnails {
|
|
}
|
|
}
|
|
|
|
|
|
move (position) {
|
|
move (position) {
|
|
- this.container.style.backgroundPosition = `-${(Math.ceil(position / this.barWidth * 100) - 1) * 160}px 0`;
|
|
|
|
- this.container.style.left = `${Math.min(Math.max(position - this.container.offsetWidth / 2, -10), this.barWidth - 150)}px`;
|
|
|
|
|
|
+ this.container.style.backgroundPosition = `-${(Math.ceil(position / this.barWrap.offsetWidth * 100) - 1) * 160}px 0`;
|
|
|
|
+ this.container.style.left = `${Math.min(Math.max(position - this.container.offsetWidth / 2, -10), this.barWrap.offsetWidth - 150)}px`;
|
|
}
|
|
}
|
|
|
|
|
|
hide () {
|
|
hide () {
|