mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
use shared slideshow
This commit is contained in:
parent
c959aa01a2
commit
3eec24c917
86 changed files with 18787 additions and 2233 deletions
65
dashboard-ui/bower_components/Swiper/src/js/parallax.js
vendored
Normal file
65
dashboard-ui/bower_components/Swiper/src/js/parallax.js
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*=========================
|
||||
Parallax
|
||||
===========================*/
|
||||
function setParallaxTransform(el, progress) {
|
||||
el = $(el);
|
||||
var p, pX, pY;
|
||||
var rtlFactor = s.rtl ? -1 : 1;
|
||||
|
||||
p = el.attr('data-swiper-parallax') || '0';
|
||||
pX = el.attr('data-swiper-parallax-x');
|
||||
pY = el.attr('data-swiper-parallax-y');
|
||||
if (pX || pY) {
|
||||
pX = pX || '0';
|
||||
pY = pY || '0';
|
||||
}
|
||||
else {
|
||||
if (s.isHorizontal()) {
|
||||
pX = p;
|
||||
pY = '0';
|
||||
}
|
||||
else {
|
||||
pY = p;
|
||||
pX = '0';
|
||||
}
|
||||
}
|
||||
|
||||
if ((pX).indexOf('%') >= 0) {
|
||||
pX = parseInt(pX, 10) * progress * rtlFactor + '%';
|
||||
}
|
||||
else {
|
||||
pX = pX * progress * rtlFactor + 'px' ;
|
||||
}
|
||||
if ((pY).indexOf('%') >= 0) {
|
||||
pY = parseInt(pY, 10) * progress + '%';
|
||||
}
|
||||
else {
|
||||
pY = pY * progress + 'px' ;
|
||||
}
|
||||
|
||||
el.transform('translate3d(' + pX + ', ' + pY + ',0px)');
|
||||
}
|
||||
s.parallax = {
|
||||
setTranslate: function () {
|
||||
s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){
|
||||
setParallaxTransform(this, s.progress);
|
||||
|
||||
});
|
||||
s.slides.each(function () {
|
||||
var slide = $(this);
|
||||
slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
|
||||
var progress = Math.min(Math.max(slide[0].progress, -1), 1);
|
||||
setParallaxTransform(this, progress);
|
||||
});
|
||||
});
|
||||
},
|
||||
setTransition: function (duration) {
|
||||
if (typeof duration === 'undefined') duration = s.params.speed;
|
||||
s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){
|
||||
var el = $(this);
|
||||
var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;
|
||||
if (duration === 0) parallaxDuration = 0;
|
||||
el.transition(parallaxDuration);
|
||||
});
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue