将jQuery代码转换为mootools 1.11 [英] Convert jQuery code to mootools 1.11

查看:110
本文介绍了将jQuery代码转换为mootools 1.11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的幻灯片需要mootools 1.11,而其他代码则需要jQuery. 不幸的是,一旦我调用jquery库,幻灯片就会崩溃.

I use a slideshow which needs mootools 1.11 and my other code needs jQuery. Unfortunately as soon as I call the jquery library the slideshow is crashing.

我可以将这个小小的jquery代码转换为moo工具或纯javascript吗? mootools代码看起来如何?

Can I convert this little jquery code in to moo tools or pure javascript? How would the mootools code look like?

jQuery(document).ready(function(jQuery) {
    jQuery('.rgstitle, .rgsdescription').click(function(event) {
        window.open(jQuery('#rgslideshow-4574 a img:visible').parent().attr('href'), '_self');    
        return false;
    });
});

非常感谢!

推荐答案

将'$'保留在基于mootools的代码中.并为您的jQuery代码使用"jQueryDollar".添加了jQuery库之后,请使用以下命令:

Leave the '$' for your mootools based code as it is. And Use 'jQueryDollar' for your jQuery codes. After adding the jquery library, use this :

<script src="jquery.js"></script>
<script>
var jQueryDollar = jQuery.noConflict();
// Do something with 'jQueryDollar'
jQueryDollar(document).ready(function(jQueryDollar) {
    jQueryDollar('.rgstitle, .rgsdescription').click(function(event) {
        window.open(jQueryDollar('#rgslideshow-4574 a img:visible').parent().attr('href'), '_self');    
        return false;
    });
});
</script>

现在在下面添加mootools库:

Now add mootools libraries just beneath:

 <script src="mootools.js"></script>
 <script>
     //'$' is now free for mootools
 </script>

这篇关于将jQuery代码转换为mootools 1.11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆