• Resolved mike_freegan

    (@mike_freegan)


    Hi all

    Please see my site here: http://tinyurl.com/ouvkj3b

    I’ve included my scripts file ([theme directory]/js/scripts.js) by enqueuing it in functions.php. I can see this has included successfully (line 193), although including directly in the header makes no difference.

    The problem is that my jQuery scripts don’t seem to do anything… even if I use scripts that I’ve used previously on other sites.For a test, for now I’ve just included a simple script: to fade out the main logo when it is clicked.

    I’m sure this will be something obvious, but I just can’t see the problem. Any help will be much appreciated.

    Code for reference:

    jQuery(document).ready(function($){
    	$(function() {
    		$('#headline_logo').click(function() {
    			$('#headline_logo').fadeToggle();
    		});
    	});
Viewing 4 replies - 1 through 4 (of 4 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    “main.js” doesn’t exist, and you haven’t closed off your ‘ready’ function, but if this is regarding your theme then have you considered talking to your theme’s vendors about this? About support for their theme?

    Thread Starter mike_freegan

    (@mike_freegan)

    Hi Andrew

    That did it, thanks. It is actually my own theme, but I am admittedly quite new to this.

    What is main.js? Is this something that I should always include in a theme?

    I wonder why it has never caused issues before.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Something called “main.js” is trying to load in your site, don’t know what that is.

    By the way are you using a browser developer tool like Firebug?

    Thread Starter mike_freegan

    (@mike_freegan)

    Hi Andrew

    I’m just using the Chrome dev tools with a couple of extensions.

    Yes, I could see that main.js was being called, but had no idea what was calling it. I assumed it was a WordPress thing or something put there by one of my many, many plugins.

    Turns out it is a placeholder I’d left in my footer when I started building this theme weeks ago to remind me to include scripts there. Derp.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘jQuery not working in theme’ is closed to new replies.