<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>永不放弃 &#187; noconflict</title>
	<atom:link href="http://www.ybfq.com/tag/noconflict/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ybfq.com</link>
	<description>电子商务师罗永强的个人网站</description>
	<lastBuildDate>Wed, 16 Nov 2011 06:53:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>用noConflict解决jQuery与其它JavaScript库冲突</title>
		<link>http://www.ybfq.com/opensources/noconflict-conflict-jquery-other-javascript-larbrary/</link>
		<comments>http://www.ybfq.com/opensources/noconflict-conflict-jquery-other-javascript-larbrary/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 06:49:38 +0000</pubDate>
		<dc:creator>Rossy</dc:creator>
				<category><![CDATA[Open Sources]]></category>
		<category><![CDATA[fcg]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[noconflict]]></category>

		<guid isPermaLink="false">http://www.ybfq.com/diary/qqreader39ac5d103aadc1fc/</guid>
		<description><![CDATA[jQuery是继prototype之后又一个优秀的Javascript框架，其宗旨是－－WRITE LESS，DO MORE（写更少的代码,做更多的事情）。它是轻量级的js库（压缩后只有21k），这是其它的js库所不及的，它兼容CSS3，还兼容各种浏览器 （IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+）。jQuery是一个快速的，简洁的javaScript库，使用户能更方便地处理HTML documents、events、实现动画效果，并且方便地为网站提供AJAX交互。由此众多便利使得很多网站都在使用jQuery，但有时由于项目需要还要用到其它的Javascript库及其插件，因此有时会遇到与jQuery的冲突，比如在MoolTools的图片幻灯片插件Featured Content Gallery(FCG)，在WordPress下使用时会与WP默认使用的jquery 1.3.2发生冲突，出现脚本错误，提示信息如下: element.getElements is not a function. 因为上次在找图片浏览插件的时候，用的是ProtoType的插件，在Drupal下建立的网站，也是用的是jQuery库，因此当时也是与jQuery发生了冲突。 当jQuery库与其它JavaScript库发生冲突时，应该在其它JS库调用前使用noConflict就可以解决，以下为FCG与jQuery的例子: &#60;script type="text/javascript"&#62; jQuery.noConflict(); function startGallery() { var myGallery = new gallery($('myGallery'), { timed: true }); } window.addEvent('domready',startGallery); &#60;/script&#62; $.noConflict()这个函数将变量$的控制权让渡给第一个实现它的那个库，这样可以确保jQuery不会与其他库的$对象发生冲突。 在运行这个函数后，就只能使用iQuery变量访问jQuery对象。例如，在要用到$(&#8220;div p&#8221;)的地方，就必须换成jQuery(&#8220;div p&#8221;)。 以下为noConflict的例子: jQuery.noConflict(); // 用jQuery代替之前的$访问对象 jQuery("div p").hide(); // 使用其他库的 $() $("content").style.display = [...]]]></description>
		<wfw:commentRss>http://www.ybfq.com/opensources/noconflict-conflict-jquery-other-javascript-larbrary/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

