Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Joomla上的jQuery和Ajax_Jquery_Ajax_Joomla - Fatal编程技术网

Joomla上的jQuery和Ajax

Joomla上的jQuery和Ajax,jquery,ajax,joomla,Jquery,Ajax,Joomla,这里是我正在谈论的网站: 它在Joomla2.5上运行,但使用Ajax(插件)加载。这个插件有一个“滚动到顶部”选项,但它与我添加的jQuery脚本(用于自定义滚动)冲突 除了jQuery库之外,还加载了用于背景动画的“jQuery.backgroundpos.js”,以及用于自定义滚动条的“jQuery.mcustomscrollbar.concat.min.js” 所以我决定自己编写一个代码,它由两部分组成。我的问题是,他们不在一起工作。。。另外,一切都很好 (function(jQuery

这里是我正在谈论的网站:

它在Joomla2.5上运行,但使用Ajax(插件)加载。这个插件有一个“滚动到顶部”选项,但它与我添加的jQuery脚本(用于自定义滚动)冲突

除了jQuery库之外,还加载了用于背景动画的“jQuery.backgroundpos.js”,以及用于自定义滚动条的“jQuery.mcustomscrollbar.concat.min.js”

所以我决定自己编写一个代码,它由两部分组成。我的问题是,他们不在一起工作。。。另外,一切都很好

(function(jQuery){
jQuery.noConflict();
    jQuery(window).load(function(){
        jQuery("#rt-mainbody").mCustomScrollbar({
            autoHideScrollbar:true,
            theme:"light-thin"  
        });
    });
})(jQuery);     

jQuery(document).ready(function() {
    jQuery('a').click(function(){
        jQuery('#rt-mainbody').animate({scrollTop:0}, 'slow');
            return false;
        });
});
我在这里错过了什么

编辑:

我还不是web编程专家,无法调试mscustomscrollbar.js。我认为由于Ajax调用,我无法通过Firebug进行调试。(是否有我不知道的解决方案?文件中的代码长达1000行,不知道要查找什么

我继续寻找解决方案,发现这个插件还有很多其他功能,比如ScrollTo功能或
.mCustomScrollbar(“更新”)
。这并没有解决问题,所以我想,这个(“更新”)函数应该在页面重新加载后调用。在Ajax plugins index.php中,有一行在每个事件后向上滚动页面。我在这里添加了“更新”功能,但出于某些原因,它不起作用这是用Ajax编写的,因此与jQuery不兼容吗?

if($this->params->get('scrlUp', 1) == 1){
        //for nice scroll ;)
        JHTML::_('behavior.framework', true);
        $cnfg_data .= "\nFLAX.Html.onall('response', function(){new Fx.Scroll(
            document.getElementById('rt-mainbody')).toTop().mCustomScrollbar('update');    
        });";
    }

谢谢

当jQuery可能还不可用时,会立即调用第一个函数,我不确定挂接到ready和load是否有意义,这样调试它可能更容易:

jQuery(function($) {
    $("#rt-mainbody").mCustomScrollbar({
        autoHideScrollbar:true,
        theme:"light-thin"  
    });
    $('a').click(function(){
        $('#rt-mainbody').animate({scrollTop:0}, 'slow');
            return false;
        });
});
然后在mCustomScrollbar中执行一些debug.log以查看它被卡住的地方