请教关于jQuery在typecho中的的使用问题!

讨论程序使用中的问题
回复
半个书生
帖子: 29
注册时间: 2009年 1月 5日 07:42
联系:

请教关于jQuery在typecho中的的使用问题!

帖子 半个书生 »

貌似jQuery在typecho中会有冲突,导致typecho部分功能js不能运行,如何解决?

如,在write-post.php中的代码:

代码: 全选

<script type="text/javascript">
    (function () {
        window.addEvent('domready', function() {
       
            /** 绑定按钮 */
            $(document).getElement('span.advance').addEvent('click', function () {
                Typecho.toggle('#advance-panel', this,
                '<?php _e('收起高级选项'); ?>', '<?php _e('展开高级选项'); ?>');
            });
           
            $(document).getElement('span.attach').addEvent('click', function () {
                Typecho.toggle('#upload-panel', this,
                '<?php _e('收起附件'); ?>', '<?php _e('展开附件'); ?>');
            });
           
            $('btn-save').removeProperty('disabled');
            $('btn-submit').removeProperty('disabled');
           
            $('btn-save').addEvent('click', function (e) {
                this.getParent('span').addClass('loading');
                this.setProperty('disabled', true);
                $(document).getElement('input[name=draft]').set('value', 1);
                $(document).getElement('form[name=write_post]').submit();
            });
           
            $('btn-submit').addEvent('click', function (e) {
                this.getParent('span').addClass('loading');
                this.setProperty('disabled', true);
                $(document).getElement('input[name=draft]').set('value', 0);
            });
           
            /** 标签自动完成 */
            var _tags = [<?php while ($tags->next()) { echo '"' . str_replace('"', '"', $tags->name) . '"'
            . ($tags->sequence != $tags->length ? ',' : NULL); } ?>];
           
            /** 自动完成 */
            Typecho.autoComplete('#tags', _tags);
        });
    })();
</script>
头像
joyqi
帖子: 422
注册时间: 2007年 7月 24日 19:43
联系:

Re: 请教关于jQuery在typecho中的的使用问题!

帖子 joyqi »

typecho后台用的是mootools库,在一些常用函数上与jquery命名重复,你可以参考一下jquery的延迟绑定部分的文档
当然,也可以直接使用mootools,也非常简单哦
半个书生
帖子: 29
注册时间: 2009年 1月 5日 07:42
联系:

Re: 请教关于jQuery在typecho中的的使用问题!

帖子 半个书生 »

[quote="70"]typecho后台用的是mootools库,在一些常用函数上与jquery命名重复,你可以参考一下jquery的延迟绑定部分的文档
当然,也可以直接使用mootools,也非常简单哦[/quote]

ok,我研究研究看看!
主要是想把xheditor编辑器做成插件,发现这个问题!
uk8u8
帖子: 4
注册时间: 2011年 4月 15日 05:27

Re: 请教关于jQuery在typecho中的的使用问题!

帖子 uk8u8 »

楼上解决这个问题木有?
我也准备把xheditor做成插件,发现此问题,来论坛上搜索到这里来的...
后来咋不用jq类.. 郁闷..
头像
binjoo
帖子: 824
注册时间: 2009年 9月 11日 11:13
来自: digu.plus
联系:

Re: 请教关于jQuery在typecho中的的使用问题!

帖子 binjoo »

http://ee19.com/blog/8.html
貌似你说的这个编辑器有插件了。。
lauyoume
帖子: 69
注册时间: 2011年 4月 13日 11:39
联系:

Re: 请教关于jQuery在typecho中的的使用问题!

帖子 lauyoume »

xheditor 现在在typecho还用不了, 如果要用只能在IE下. FF和Chrome下有Bug,因为Mootools和Jquery冲突, 前天晚上我还研究了一个晚上.. 即使用Jqurey.noConflict()也不行的.

我还查出 主要是 xheditor内部代码用$(selector,htmlCode) 这种方式引起的..mootools与jquery内部冲突-.- 偶也没解决。
回复