开发者

Using jQuery for Joomla Modules. - How?

开发者 https://www.devze.com 2023-02-16 15:59 出处:网络
I\'ve just created a module for Joomla 1.6 that uses jQuery for its animation. So far I have done, $document= JFactory::getDocument();

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 don开发者_JAVA百科e 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 ?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消