Thanks, nice that you’re willing to dive into it!
But I think I’ve found a solution! The site is still local on my Mac, by the way. But this is what I did, basically putting the scripts in the parent theme instead of the child theme:
1. I left the div in the child theme’s header.php and css styling alone, but deleted the child theme’s functions.php and js file I made earlier.
2. Made a js folder in the PARENT theme and put the js file (called backbutts.js) in there with this script:
(function($){
$(document).scroll(function () {
var x = $(this).scrollLeft();
if (x > 100) {
$('.topMenu').fadeIn(300);
} else {
$('.topMenu').fadeOut(300);
}
});
})(jQuery);
3. in the PARENT theme’s functions.php I added just before the closing php tag this function (based on suggestions I found here ):
function my_init() {
if (!is_admin()) {
wp_enqueue_script('jquery');
// load a JS file from my theme: js/theme.js
wp_enqueue_script('my_script', get_bloginfo('template_url') . '/js/backbutts.js', array('jquery'), '1.0', true);
}
}
add_action('init', 'my_init');
And this works like magic! Even when logged in.
Now I suspect that it could be something in the parent theme I’m using: BlankSlate, which is a stripped down ‘boiler plate theme’, ment to build things from scratch. Uptill now I did everything in a child theme set up, which usually works. Somewhere I read suggestions by the theme’s developers that eventually it’s best to create a new theme with it rather then sticking to a child theme. I’m beginning to see why ??
Maybe I’ll post a question about this on the theme’s support forum. For the moment, however, I’m happy.
Thanks anyway, for your follow up! Really nice.