PDA

View Full Version : jquery conflict



neilphill1
03-13-2013, 10:33 PM
1) Script Title: jquery.magnifier.js

2) Script URL (on DD): www.slate.zxq.net

3) Describe problem: hi i am new to j query but very interested in how it works i understand html , css and a little java but my new project web site uses j query plugins what i have done is used the following plugins and they work fine fancybox cookie js and slideshow js everything works when i split the links and scripts up top page and bottom page (please see source www.slate.sxq.net (http://slate.zxq.net)) i have then added the magnifier js to my design and it seems to conflict with all of my other j query plugins and cancels them out... this is driving me crazy as i do think its some thing to do with the no conflict but i cant seem to get it to work i would appreciate some help please. look forward to your reply

n :)

jscheuer1
03-14-2013, 01:16 AM
As with many of DD's earlier forays into jQuery, magnifier was written assuming there would be no other jQuery scripts on the page and that there might be other script libraries on the page needing the $ variable. As such, it uses the jQuery.noConflict() directive near its beginning. However, if you're a sane person running jQuery as the only javascript library and are using two or more jQuery based scripts on the page, this causes problems. Easy solution. Using a text only editor like NotePad, in jquery.magnifier.js comment out that directive as shown:


/* jQuery Image Magnify script v1.1
* This notice must stay intact for usage
* Author: Dynamic Drive at http://www.dynamicdrive.com/
* Visit http://www.dynamicdrive.com/ for full source code

* Nov 16th, 09 (v1.1): Adds ability to dynamically apply/reapply magnify effect to an image, plus magnify to a specific width in pixels.
* Feb 8th, 11 (v1.11): Fixed bug that caused script to not work in newever versions of jQuery (ie: v1.4.4)
*/

//jQuery.noConflict()

jQuery.imageMagnify={
dsettings: {
magnifyby: 3, //default increase factor of enlarged image
duration: 500, //default dur . . .

Save and use that version.

The browser cache may need to be cleared and/or the page refreshed to see changes.

neilphill1
03-14-2013, 11:16 AM
Hi John

thank you for your quick reply to my first ever (and not the last!) post i will have time this evening to try your theory thank you again for your help! before i forget just a quick question while we are on the subject i have three or four library's on my site and i have had to move one down to the bottom of my page (next to the body tag) to make it work is this some kind of conflict or just the way it should be or set up? your expert advice would be much appreciated.

n:)

jscheuer1
03-14-2013, 03:57 PM
That would depend upon the situation on the page, quite possibly there is a conflict. If moving it there makes everything work, go with it.

neilphill1
03-14-2013, 09:59 PM
hi john works ! thanks