Javascript window.scroll in custom template

Hi, we need a sticky div-layer in my custom template with “window.scroll”, but had even no chance with this test code here (all other javascripts in the page are working):

jQuery(function($) {
	
	// Test Code
	$(window).scroll(function() {
	    if ($(window).scrollTop() > 100) {

	        console.log('test1');
	    }
	    else {
	        console.log('test2');
	    }
	});
	
	});

Thanks for help

Hello Stefan,

Thanks for posting in!

I have tested your Javascript code and it works. You will need to apply or modify it more to accomplish what you have in mind. Just to let you know that it is already more into customizations and not on theme issues, bug fixes or minor cosmetic changes. Regretfully this customization is beyond the scope of our support.

If you are not an expert code or familiar with Javascripts, you may need to look for 3rd party plugins that may handle your customization.

Thank you for your understanding.

hi! thank you for the answer, but unfortunately it was not very helpful for us.
Yes, the code works (its asimple test), but the thing is that when we try this in a standard wordpress theme template (even custom made) i get a response in the console (it is the simplest way to check if the basic functionality works), but not in the apex pro installation. this seems very strange because, as said before, all other javascripts are working. I think that maybe something is blocking these standard call with “window.scroll”.
So please if there is a chance to place the code anywhere else (not into options javascript, i have tested that too it does not work) then this would be great to know. thank you very much.

Hi Stefan,

I have tested that JS code on my PRO dev site as well and it works



This means the issue is not on the PRO theme. It could be a conflict with another plugin on your site or a caching related. Please do the following:

  • Clear all the site caches (plugin, server-side, CDN, and browser’s cache) so that the code from the latest release is always in use. This will help you to avoid any potential errors. Please deactivate this caching features while we tackle this issue.

  • Test for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

If you want to add the script other than Theme Options > JS area, please follow this link.

Thanks,

1 Like

thank you very much, this was very helpful!!!

You’re welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.