找回密码
 注册加入

扫一扫,极速登录

QQ登录

只需一步,快速开始

搜索
查看: 2238|回复: 0

discuz如何解决jquery冲突的问题

[复制链接]
发表于 2011-10-25 14:04:33 | 显示全部楼层 |阅读模式
为什么冲突呢?因为jquery用的是$符号选择页面元素,discuz呢内置$,所有就冲突了,但jquery有解决方案,不知道的去官方看看文档吧。举个例子吧,滑动切换,代码


  1. <script language="JavaScript" type="text/javascript" src="static/js/jquery-1.6.4.min.js"></script>
  2. <script>
  3.    var jq = jQuery.noConflict();
  4.    jq(function(){
  5.     jq('.t1').hover(function(){
  6.            jq('.cont1').show();
  7.            jq(this).css('color','#ccc');
  8.            jq(this).css('cursor','pointer');
  9.            jq('.cont2').hide();
  10.         },function(){
  11.            jq(this).css('color','#000');
  12.         });
  13.         jq('.t2').hover(function(){
  14.            jq('.cont2').show();
  15.            jq(this).css('color','#ccc');
  16.            jq(this).css('cursor','pointer');
  17.            jq('.cont1').hide();
  18.         },function(){
  19.            jq(this).css('color','#000');
  20.         });
  21.   });
  22. </script>
  23. <!--{subtemplate common/footer}-->
复制代码
看代码,应该知道代码在什么位置吧。重点是:  var jq = jQuery.noConflict();
您需要登录后才可以回帖 登录 | 注册加入  

本版积分规则

Archiver|手机版|小黑屋|Discuz!扩展中心 ( 浙ICP备14042422号-1 )|网站地图QQ机器人

GMT+8, 2024-5-4 11:31 , Processed in 0.172909 second(s), 12 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表