Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Problems using JQuery with WordPress

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #30720

    Hi guys, I’ve tried to post this question on both the wordpress and jquery forums and have gotten zilch. Here’s the question I posted on the WP forum:

    I’m designing a theme on a local host and am trying to use a simple jquery function on my main page that cycles through a handful of images, fading between each image.

    I’m loading jquery using google in my functions.php by using this:

    if( !is_admin()){
    wp_deregister_script('jquery');
    wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"), false, '1.4.4');
    wp_enqueue_script('jquery');
    }

    and I’m also doing this in the head section of my header.php, which is probably where I’m going wrong:







    I’ve created a DIV with an id of ‘slideshow’ in my CSS and given it a width and a height.

    I’m a TOTAL newbie to javascript/jquery so for all I know, I’m doing this completely wrong. Does anyone have any idea why this isn’t working?

    Let’s see, what else? I’m also using a couple of plugins that use javascript. Are those interfering? Any help at all will be greatly appreciated. Thanks so much!

    #74795
    cybershot
    Participant

    the first thing I do when I don’t get any results from my javascript is I make sure the javascript is being called correctly. You can do this by throwing in an alert

    alert(“hello”);

    if the alert don’t pop up, then you know what the problem is. I have also never seen the sleep: 2 fade: 1

    #74800
    jfreehill
    Member

    I’m fairly sure that once you put the code to enqueue within functions, WordPress will automatically load that script into the head of the page, so it’s not necessary to put in the header.php file.

    Also if your reference to the jquery.cross-slide.js script is actually as you have it written – /js/jquery.cross-slide.min.js”> – then that would definitely not be grabbing anything and should look more like this:

    So take out the from the header and put in the source to the script as noted above, below the the wp_head tag.


    @cybershot
    I mentioned this in another post but just doing that won’t test if jQuery is loaded, just if JavaScript in general is on. You’d have to put that in the jQuery script for that to work which isn’t possible using a CDN hosted version of it. To test if jQuery is loaded grab Firebug for Firefox and type jQuery in the debug console, if it returns as function() then it’s loaded, otherwise it will give an error.

    #74732

    @jfreehill

    This doesn’t seem to do it. I don’t know why my post read as “/js/jquery.cross-slide.min.js”>”, it must’ve been a weird copy and paste thing. I had it typed as you suggested, but I still have no luck.

    I’ve tried everything I can imagine, and this script still isn’t running. I read that there seems to be some issue regarding the $ symbol, and that it can be resolved by typing jQuery before a function–something to do with a ‘no conflict’ mode, but that doesn’t work either.

    Thanks for your help, though.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.