ThemeShaper Forums » Thematic

[closed]

Can't seem to get jQuery working...

(3 posts)
  • Started 12 years ago by Rossifer
  • Latest reply from Rossifer
  • This topic is resolved
  1. Rossifer
    Member

    Hi, love the Thematic framework and I'm currently skinning a site where there is a promo box at the top which shows 5 images continually rotating.

    Now jFlow allows me to do this and I can get it working as a local HTML file on my development machine so I know it works. However when I try to add it to my child theme using functions.php I get problems.

    Firebug tells me this:

    jQuery("#myController").jFlow is not a function

    Can anyone help I'm guessing it is to do with a JavaScript conflict but I'm stuck so here is my code. Help me Obi Wan you're my only hope!

    function childtheme_add_js() { ?>
    
    <script type="javascript" src="js/jflow.plus.js"></script>
    
    <script language="javascript">
    
    jQuery.noConflict();
    
    	jQuery(document).ready(function(){
    	    jQuery("#myController").jFlow({
    			controller: ".jFlowControl", // must be class, use . sign
    			slideWrapper : "#jFlowSlider", // must be id, use # sign
    			slides: "#mySlides",  // the div where all your sliding divs are nested in
    			selectedWrapper: "jFlowSelected",  // just pure text, no sign
    			width: "960px",  // this is the width for the content-slider
    			height: "350px",  // this is the height for the content-slider
    			duration: 400,  // time in miliseconds to transition one slide
    			prev: ".jFlowPrev", // must be class, use . sign
    			next: ".jFlowNext", // must be class, use . sign
    			auto: true	// true or false
        });
    });
    </script>
    <?php }
    Posted 12 years ago #
  2. you are using a relative path to your script so it's never going to work.

    check out this thread: http://forums.themeshaper.com/topic/how-can-i-place-jquery-masonry-on-my-home-page

    i went through a fairly detailed description of how to get a jquery plugin working. you'll probably also want to use wp_enqueue_script which i talk about on the other thread.

    lastly, if you view source... and then try to click on the link for your script... and you get the script's code all is well. but often you will get File Not Found which will tell you that you aren't referencing the file properly. i check that all the time to attempt to isolate the problem. can't even begin to diagnose errors in the code/functions if the scripts aren't being loaded.

    Posted 12 years ago #
  3. Rossifer
    Member

    Thank you I followed your link and I got it working. But sweet Moses it was pretty tough making Wordpress play nice with jQuery.

    Everything else is so nice with Wordpress, why is this so fiddly and annoying?

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.