Question

I've just created a module for Joomla 1.6 that uses jQuery for its animation.

So far I have done,

$document           = JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'modules/mod_op_slideshow/assets/css/slideshow.css');
$document->addScript(JURI::base() . 'modules/mod_op_slideshow/assets/js/menuRotate.js');
$document->addScript(JURI::base() . 'modules/mod_op_slideshow/assets/js/jquery.js');
$document->addScript(JURI::base() . 'modules/mod_op_slideshow/assets/js/script.js');

With firebug, it appears that my scripts and css have been loaded. In order for my animations to work, I require to have my code initialized inside document ready, which I have already included in script.js

$(document).ready(function(){
$('ul#slidemenu').menuRotate({
    speed: 1230,
    timeout: 5000,
    opacity: '0.6',
    containerheight: '300px'
});

Unfortunately, it doesn't seem to be initializing the codes.. One of the errors that was displayed on firebug was:

jQuery is not defined [Break On This Error] })(jQuery);

Have I done correctly with adding the scripts into Joomla and initializing the code with document.ready inside script.js ? or am I even making sense with this problem ?

Was it helpful?

Solution

Problem could be in your menuRotate.js script. If your menuRotate.js script uses jQuery you should put it after jQuery.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top