jquery-script在joomla 2.5模板中不起作用

时间:2013-08-08 18:39:01

标签: jquery templates joomla

我在joomla 2.5模板上遇到jquery的问题。 没有Joomla,我的jquery脚本(rcarousel)工作正常。 这是我的 index.html ,而不是Joomla!模板(连接js-scripts):

<script type="text/javascript" src="widget/lib/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="widget/lib/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="widget/lib/jquery.ui.widget.min.js"></script>
<script type="text/javascript" src="widget/lib/jquery.ui.rcarousel.min.js"></script>
<script type="text/javascript" src="scripts.js"></script>
<link type="text/css" rel="stylesheet" href="widget/css/rcarousel.css" />

它是 scripts.js 中的脚本:

    jQuery(function($) {
    $( "#carousel" ).rcarousel({width: 235, height: 170, visible: 4, step: 4, margin: 5,
    auto: {enabled: true, direction: "next", interval: 5000}, 
    navigation: {prev: "#ui-carousel-prev",next: "#ui-carousel-next" } } );

    $( ".image_slider_right_ex" ).rcarousel({width: 185, height: 160, visible: 5, step: 5, margin: 5,
    auto: {enabled: true, direction: "next", interval: 5000}, orientation: "vertical",
    navigation: {prev: ".slider_right_arrow_down_link",next: ".slider_right_arrow_top_link" } 
    });

    $( "#carousel_laredo" ).rcarousel({width: 320, height: 148, visible: 3, step: 3,
    auto: {enabled: true, direction: "next", interval: 5000},
    navigation: {prev: "#slider_button_left_laredo_link",next: "#slider_button_right_laredo_link" }
    });

    $( ".image_slider_right_laredo_ex" ).rcarousel({width: 210, height: 255, visible: 4, step: 4, margin: 5,
    auto: {enabled: true, direction: "next", interval: 5000}, orientation: "vertical",
    navigation: {prev: ".slider_button_right_laredo_link",next: ".slider_button_left_laredo_link" } 
    });

    $( "#image_gallery_canter_element" ).rcarousel({width: 210, height: 255, visible: 3, step: 1, margin: 2,
    navigation: {prev: "#gallery_button_left",next: "#gallery_button_right"} 
    });
});

我在Joomla中连接脚本!:

 $doc = JFactory::getDocument();
 $doc->addScript($this->baseurl.'/templates/'.$this->template.'/javascript             /scripts.js',   'text/javascript');
 $doc->addScript($this->baseurl.'/templates/'.$this->template.'/javascript/lib/jquery.ui.core.min.js', 'text/javascript');
 $doc->addScript($this->baseurl.'/templates/'.$this->template.'/javascript/lib/jquery.ui.widget.min.js', 'text/javascript');
 $doc->addScript($this->baseurl.'/templates/'.$this->template.'/javascript/jquery.ui.rcarousel.min.js', 'text/javascript');

我安装了easy-jquery插件。但我有错误:

TypeError: $(...).rcarousel is not a function

它有相同的源代码,也就是说它是连接的jquery脚本。但我无法理解为什么它不起作用。请帮帮我。

1 个答案:

答案 0 :(得分:0)

我认为,你的问题是由jquery-mootools冲突造成的(他们都使用$) 问题在以下问题中讨论:How to fix Mootools and jQuery conflict on Joomla aiContactSafe