Detaching gives us the possibility to grab, hide and put slide content outside the slider items and may elsewhere in the document.
var myslider = new YerSlider();
myslider.init({
sliderid: '.mysliderclass',
slidegap: 10,
slidegroupresp: {
0: 1,
450: 2,
900: 3
},
loop: 'infinite',
animationspeed: 1000,
bullets: true,
autoplay: true,
autoplayinterval: 2000,
autoplaydelaystart: 0,
autoplaystoponhover: true,
detach: {
// targets inserting new empty detaching containers outside the slider
targets: {
'1': {
selector_wrap: '.detach-target',
selector_item: '.detach-target-item',
insert_selector: 'viewport', // 'wrap' (the current slider wrap) / 'viewport' / 'bullets' / 'thumbs' / class / id
insert_method: 'after', // before, after, append, prepend
template_wrap: '<div class="detach-target">{content}</div>', // html
template_item: '<div class="detach-target-item">{content}</div>', // html
change: function( p ) {
/**
This function is called on every slide-change and
is intended to show the current detachings.
p: {
items: objects,
items_current: objects
}
*/
// example of the demo showing only detachings of the current slides
var root = p.items.parents( '.detach-target' ),
height = root.height();
root.css( 'height', height + 'px' );
window.setTimeout( function () {
p.items.fadeOut( 90 );
}, 600 );
window.setTimeout( function () {
p.items_current.fadeIn( 300 );
window.setTimeout( function () {
root.css( 'height', 'auto' );
}, 100 );
}, 700 );
},
}
},
// sources defining some slide content and put them into an target
sources: {
'1': {
target_id: '1',
selector: '.detach-me p',
source: 'element', // element / content
remove: '.detach-me', // selector
},
},
},
});