Custom Logo Animation on Scroll – Can’t Get JavaScript Working (403 Errors)
-
Hey, you don't need to wrap a scroll event handler in
newPageShown.Just remove the new page shown, outer text.
Your code starts with jQuery(window).on('scroll',I think a 403 error is not a JavaScript error. It's a HTTP error. If you Google "403 error," you will find out more. Do you have a link to the website where you are trying to do this?
-
Also, you don't need a scroll spacer if you have enough content on your page. If you take a look at the body class, Lay Theme already adds an HTML class when you scroll down and removes it when you scroll up.
This HTML class is called. lay-scrolled-down
So theoretically, you don't even need your JavaScript.
-
thanks! yes this is the website: https://asistenciaartistica.com
-
Okay, when I'm here on my Chrome browser, I can scroll down and the logo gets smaller, and I don't see any 403 error
-
I was getting the 403 error in the custom css+html section after adding javascript. now I did what you suggested and it works! only thing is every time I reach the bottom the animation goes back to what it is at the top and it glitches, what could be causing this?
-
Okay, yeah I see. It's better to use your JavaScript for setting the HTML class for scroll up or down.
Because my JavaScript that sets the laytheme scroll up or down class works differently.
-
<script> jQuery(window).on("scroll", function() { if (jQuery(window).scrollTop() > 50) { jQuery("body").addClass("scrolled"); } else { jQuery("body").removeClass("scrolled"); } }); </script>Your JavaScript needs to look like this. You need to add the script tags around your JavaScript.
-
ok thanks so much!
-
also I see you added my other website to the featured list, eduardocaballero.com, glad you liked it. love lay theme thanks for the work!
-
Yeah, their website is also really nice. Thanks a lot!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login