Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

jQuey doesn't show the animation effects on wordpress

theme.js:

jQuery(document).ready(function($) {

    $("body").css("display","inline");

    $(".top-nav ul").hide();

    $("#logo img").hide();

    $("#bg").hide();

    $("#logo img").slideDown(300,function() {

      $(".top-nav ul").fadeIn(500,function() {

        $("#bg").slideDown(500);

      });

    });

}

The page shows the script src it means I included it correctly with the wp_enqueue_script funtion.

< script type="text/javascript" src="http://localhost/wordpress/wp-content/themes/portfolio/assets/js/main.js?ver=3.7.1" ></script>

Please help.. This really almost shuts my brain down.. Y_Y

8 Answers

Jonathan Davies
Jonathan Davies
2,162 Points

Yeah i've just found this out as well .fadeIn and .fadeOut isn't working for me either, i thought it was my code but i removed everything and hard code both jQuery and the script for what I was using it for and it didn't work.

This is what i was using it for: http://source.tutsplus.com/webdesign/tutorials/010_back-to-top-button/HTML/index.html

I wonder how to make this work... I have been checking google since last night and tried a lot but still didn't work... Please let me know if you found a soluton. X_X

I wonder how to make this work... I have been checking google since last night and tried a lot but still didn't work... Please let me know if you found a soluton. X_X

Jonathan Davies
Jonathan Davies
2,162 Points

Yeah i've doing the same for the last hour or so, but if i find anything ill leave a reply.

Thanks. Really appreciate it

I made my jquery functions work.. Still need help?

First I included the jQuery file by:

if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);

function my_jquery_enqueue() {

wp_deregister_script('jquery');

wp_register_script('jquery', get_template_directory_uri() . '/assets/js/jquery.js', false, '', true);

wp_enqueue_script('jquery');

}

then did some debuging by looking for erros in the browser.. Killed errors line by line. I can help you if still aint fixed after trying this.

Jonathan Davies
Jonathan Davies
2,162 Points

Ah yeah, i've got something similar, not sure if its right though:

if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11); function my_jquery_enqueue() { wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", false, null); wp_enqueue_script('jquery'); }

It should be working.. I assume that the error is on the .js script you have.. We can share codes if you want. For me to look for the error in my end too.

Jonathan Davies
Jonathan Davies
2,162 Points

http://pastebin.com/iQAMJGrJ

It's on pastebin, the first chunk of codes works because its for a portfolio filter thats work, also the flexslider is working.

Hmmhm, js is looking good.. hard to debug if we can't test all the files.. anyway hope you figure that out soon.. ^_^ or we can share screens to work that out together.. :)

Jonathan Davies
Jonathan Davies
2,162 Points

Im still working locally at the moment.

you can email me at storytellercontact@gmail.com if you want to debug it together with teamviewer... ciao

Jonathan Davies
Jonathan Davies
2,162 Points

Hey sorry for the long reply, I managed to fix the code. The fix was to set fadeIn() and fadeOut() to fadeTo([duration], [opacity]), the duration is how quick you want it to fade and what you want opacity you want it to fade to. In my case it would be opacity 1 first followed by 0.