Home › Forums › WoodMart support forum › HELP WITH JAVASCRIPT OR JQUERY AND WODMART › Reply To: HELP WITH JAVASCRIPT OR JQUERY AND WODMART
maverick10
Sorry I got confused about the ticket in the previous message, I rewrite the correct answer in this ticket:
The code performs the function of making the “Volver al Curso” and “MENU CURSO” buttons of this page sticky: THIS IS THE NEW CODE:
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 200) {
$(“div.jet-mobile-menu__instance.jet-mobile-menu__instance–slide-out-layout.left-container-position.default-toggle-position”).addClass(“fixed2”);
$(“.elementor-jet-button”).addClass(“fixed1”);
} else{
$(“div.jet-mobile-menu__instance.jet-mobile-menu__instance–slide-out-layout.left-container-position.default-toggle-position”).removeClass(“fixed2”);
$(“.elementor-jet-button”).removeClass(“fixed1”);
}
});
LOOK THIS IN THE WEB: https://tuwebtop.com/eunicegarciaruiz6/cursos/curso-inicio-activados/module-1/bienvenid-a-los-activados/
I have copied the code on the document ready and this does not work, it only works if I copy the code in the header.php making a call to jquery and it looks like this:
<script src=”https://code.jquery.com/jquery-3.5.1.min.js”></script>
<script>
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 200) {
$(“div.jet-mobile-menu__instance.jet-mobile-menu__instance–slide-out-layout.left-container-position.default-toggle-position”).addClass(“fixed2”);
$(“.elementor-jet-button”).addClass(“fixed1”);
} else{
$(“div.jet-mobile-menu__instance.jet-mobile-menu__instance–slide-out-layout.left-container-position.default-toggle-position”).removeClass(“fixed2”);
$(“.elementor-jet-button”).removeClass(“fixed1”);
}
});
</script>
THIS IS AN AGONY.
BECAUSE I WANT TO GET THAT I DO NOT HAVE TO MAKE A CALL TO JQUERY AGAIN, BECAUSE THE THEME ALREADY HAS JQUERY, RIGHT?
HOW COULD IT BE SOLVED?
IS THERE A PURE JAVASCRIPT CODE WITHOUT JQUERY, THAT MAKES THE IDENTICAL FUNCTION TO COPY IN THE CUSTOMIZED JS SECTION?