| Server IP : 62.60.133.156 / Your IP : 216.73.217.51 Web Server : LiteSpeed System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64 User : mimradmin ( 1166) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/mimradmin/theme/digitaz/assets/js/ |
Upload File : |
/*global digitaz_sticky_add_to_cart_params */
( function() {
"use strict";
document.addEventListener( 'DOMContentLoaded', function() {
var stickyAddToCart = document.getElementsByClassName( 'digitaz-sticky-add-to-cart' );
if ( ! stickyAddToCart.length ) {
return;
}
if ( typeof digitaz_sticky_add_to_cart_params === 'undefined' ) {
return;
}
var trigger = document.getElementsByClassName( digitaz_sticky_add_to_cart_params.trigger_class );
if ( trigger.length > 0 ) {
var stickyAddToCartToggle = function() {
if ( ( trigger[0].getBoundingClientRect().top + trigger[0].scrollHeight ) < 0 ) {
stickyAddToCart[0].classList.add( 'digitaz-sticky-add-to-cart--slideOutUp' );
stickyAddToCart[0].classList.remove( 'digitaz-sticky-add-to-cart--slideInDown' );
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
stickyAddToCart[0].classList.add( 'digitaz-sticky-add-to-cart--slideInDown' );
stickyAddToCart[0].classList.remove( 'digitaz-sticky-add-to-cart--slideOutUp' );
}
} else if ( stickyAddToCart[0].classList.contains( 'digitaz-sticky-add-to-cart--slideOutUp' ) ) {
stickyAddToCart[0].classList.add( 'digitaz-sticky-add-to-cart--slideInDown' );
stickyAddToCart[0].classList.remove( 'digitaz-sticky-add-to-cart--slideOutUp' );
}
};
stickyAddToCartToggle();
window.addEventListener( 'scroll', function() {
stickyAddToCartToggle();
} );
// Get product id
var product_id = null;
document.body.classList.forEach( function( item ){
if ( 'postid-' === item.substring( 0, 7 ) ) {
product_id = item.replace( /[^0-9]/g, '' );
}
} );
if ( product_id ) {
var product = document.getElementById( 'product-' + product_id );
if ( product ) {
if ( ! product.classList.contains( 'product-type-simple' ) && ! product.classList.contains( 'product-type-external' ) ) {
var selectOptions = document.getElementsByClassName( 'digitaz-sticky-add-to-cart__content-button' );
selectOptions[0].addEventListener( 'click', function( event ) {
event.preventDefault();
document.getElementById( 'product-' + product_id ).scrollIntoView();
} );
}
}
}
}
} );
} )();