Update thumbnails.js
This commit is contained in:
parent
892224d6c9
commit
7dfd75796f
|
|
@ -1,15 +1,16 @@
|
|||
class Thumbnails {
|
||||
constructor (options) {
|
||||
this.container = options.container;
|
||||
this.barWrap = options.barWrap;
|
||||
this.barWidth = options.barWidth;
|
||||
this.container.style.backgroundImage = `url('${options.url}')`;
|
||||
this.events = options.events;
|
||||
}
|
||||
|
||||
resize (width, height) {
|
||||
resize (width, height, barWrapWidth) {
|
||||
this.container.style.width = `${width}px`;
|
||||
this.container.style.height = `${height}px`;
|
||||
this.container.style.top = `${-height + 2}px`;
|
||||
this.barWidth = barWrapWidth;
|
||||
}
|
||||
|
||||
show () {
|
||||
|
|
@ -18,8 +19,8 @@ class Thumbnails {
|
|||
}
|
||||
|
||||
move (position) {
|
||||
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`;
|
||||
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`;
|
||||
}
|
||||
|
||||
hide () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue