Hi Juliana,
The problem is that jCarousel is loading before jQuery is loaded. You’ll need to change the load order of your scripts.
Are you loading jCarousel directly, or using the enqueue script function? I think if you remove it from your template and put this in your functions.php, it should work again
function load_scripts() {
wp_register_script( 'jcarousellite', 'http://www.julianamaeberger.com/soma/wp-content/themes/Starkers/js/jcarousellite.js', false, '1.0.1', false);
wp_enqueue_script( 'jcarousellite' );
}
add_action('init', 'load_scripts' );
Hi Dalton,
Thanks so much for helping out with this. I added script to functions.php and they seem to be loading in the right order now – JQuery, then JCarousel.
It’s still not working though.
http://www.julianamaeberger.com/soma/work/
Do you have any other suggestions?
Juliana
Ah, sorry, I didn’t see the script you were using to initiate the jCarousel. WordPress loads jQuery in noconflict mode, so you’ll need to wrap your function like this:
jQuery(document).ready(function($){
$(".default .jCarouselLite").jCarouselLite({
btnNext: ".default .next",
btnPrev: ".default .prev",
visible: 4,
scroll:4,
speed:100
});
});
(I’m pretty sure that should work!)
Dalton
Noconflict mode eh? Interesting.
That worked!
Happy new year!
Yeah, using no conflict mode is smart for plugins because you never know if someone is going to have another javascript library loaded up which will cause everything to go bonkers. Of course, it’s also possible that it will cause problems like you experienced, so it’s a trade off.
When I’m building a theme, I usually put all of my javascript into an external file, wrap all of the jQuery code with the function I used above, and then call it at the bottom of the page with the enqueue function. I think that’s generally the safest way to do it.