
Originally Posted by
amberbam
I thought.. that can't be it, but then I tested and voila! The lightboxes were working in Safari and IE. That was awesome..
noConflict is used when there are multiple scripting libraries competing for the $() object, such as Prototype and jQuery. noConflict tells jQuery to release its hold on the $() object, allowing it to be used by whichever other library was wanting to use it.
It also means that any jQuery references afterwards to $() must be changed to jQuery instead, but once inside a jQuery context you can use a $ parameter to allow you to continue to use $ inside of that context.
So:
HTML Code:
<!-- Some other scripting library such as Prototype may be using $ for itself up here -->
<script type="text/javascript" src="/js/jquery-1.7.2.js"></script>
<!-- Now jQuery has taken over the $ object, which means that Prototype code cannot work at this point here -->
<script type="text/javascript" src="js/script.js"></script>
Code javascript:
// Now we tell jQuery to remove its hold on the $ object, reverting it back to what it was before jQuery was loaded
// This means that Prototype (or whatever else was using $) now regains use of the $ object for itself
jQuery().noConflict();
// Now we use the jQuery object as a wrapper our jQuery code
jQuery(function ($) {
// and thanks to that $ in the parameter of the function,
// all of the code inside of here can now safely use the jQuery $ object for itself again
});

Originally Posted by
amberbam
So can anyone help a complete js/jquery noob out here? Please?

The notes above should help you to understand what is happening and why.
Bookmarks