Initial commit
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
function generate_sections_parallax_element( selector, context ) {
|
||||
context = context || document;
|
||||
var elements = context.querySelectorAll( selector );
|
||||
return Array.prototype.slice.call( elements );
|
||||
}
|
||||
|
||||
window.addEventListener( "scroll", function() {
|
||||
var scrolledHeight= window.pageYOffset;
|
||||
generate_sections_parallax_element( ".generate-sections-container.enable-parallax" ).forEach( function( el, index, array ) {
|
||||
var limit = el.offsetTop + el.offsetHeight;
|
||||
if( scrolledHeight > el.offsetTop && scrolledHeight <= limit ) {
|
||||
el.style.backgroundPositionY = ( scrolledHeight - el.offsetTop ) / el.getAttribute( 'data-speed' ) + "px";
|
||||
} else {
|
||||
el.style.backgroundPositionY = "0";
|
||||
}
|
||||
});
|
||||
});
|
1
wp-content/plugins/gp-premium/sections/functions/js/parallax.min.js
vendored
Normal file
1
wp-content/plugins/gp-premium/sections/functions/js/parallax.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
function generate_sections_parallax_element(e,t){var o=(t=t||document).querySelectorAll(e);return Array.prototype.slice.call(o)}window.addEventListener("scroll",function(){var e=window.pageYOffset;generate_sections_parallax_element(".generate-sections-container.enable-parallax").forEach(function(t,o,n){var a=t.offsetTop+t.offsetHeight;e>t.offsetTop&&e<=a?t.style.backgroundPositionY=(e-t.offsetTop)/t.getAttribute("data-speed")+"px":t.style.backgroundPositionY="0"})});
|
Reference in New Issue
Block a user