glide
glide copied to clipboard
Peak + Bound
I can't understand how to delete peak (left margin) in slider mode with bound. I just don't need to show the free space after last item.

I made a custom transformer to remove peek from last item with 'bound' option. Feel free to use it!
var FixBoundPeek = function (Glide, Components, Events) {
return {
/**
* Fix peek 'after' with 'bound' option.
*
* @param {Number} translate
* @return {Number}
*/
modify (translate) {
var isBound = Components.Run.isBound
// future method from 'master'
if (typeof isBound !== 'function') {
isBound = function () {
return Glide.isType('slider') && Glide.settings.focusAt !== 'center' && Glide.settings.bound
}
}
if (isBound() && Components.Run.isEnd()) {
const peek = Components.Peek.value
if (typeof peek === 'object' && peek.after) {
return translate - peek.after
}
return translate - peek
}
return translate
}
}
}
new Glide('.glide')
.mutate([FixBoundPeek])
.mount()
@Djules thanks for this, this worked perfectly!