PDA

View Full Version : jQuery Confliction Issues



kaushal
11-08-2011, 02:02 PM
I am getting error when prototype.js & one other js both are in a same page.
What should be the solution?

Actually I am having a slider in a page that is using a js file named "all.js" & in that page drop-down menu is there.
pls. see http://eagle.arvixe.com/~houselav/index.php/gallery/chanel-gallery.html (In this page “Shop” menu is having a drop-down menu).

Now when including "all.js" file if I write jQuery.noConflict(); after including "all.js" then slider stops working & if I do not write no-conflict() after including "all.js" then drop-down menu stop coming.

Any solution?

Thanks.

jscheuer1
11-08-2011, 05:56 PM
Is all.js only for the slider? If so, get rid of it, it's a pile of ****. Find another script for a slider, there are at least 1000's.

kaushal
11-09-2011, 04:30 AM
Thanks jscheuer for your reply but can you look into script? & can you give solution for it?

Yes all.js is only for the slider.

If I write jQuery.noConflict(); after including "all.js" then error comes -
$(b) is null
[Break On This Error] eval(function(p,a,c,k,e,r){e=function(...r|try|area|firefox'.split('|'),0,{})).

If I do not write jQuery.noConflict(); after including "all.js" then error comes -
element.dispatchEvent is not a function
[Break On This Error] element.dispatchEvent(event);
prototype.js (line 4079)
uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMXPathEvaluator.evaluate]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://eagle.arvixe.com/~houselav/js/prototype/prototype.js :: anonymous :: line 1528" data: no]
[Break On This Error] Selector._div.querySelector(this.expression);

Any Solution please because I can not use any other script. I have done this slider with a huge difficulty & now it would be good if I do not require to change it.

Please.

Thanks.

jscheuer1
11-09-2011, 04:58 AM
I did look into it. I even 'fixed it'. The problem though is that it is designed for a multitude of uses and you're only using one thing. The same thing apparently with Prototype. It's absurd to use so much code for a single drop down, likewise for a simple slider. And one library or the other (Prototype or jQuery) can easily handle both tasks - generally any javascript tasks for a website. And one version of jQuery - if that's the one you choose, should be sufficient.

Further, even when the slider is working, it has issues in IE 9 and Opera - even more reason to get another slider. This may be due to the fact that even when jQuery is in noConflict mode it sometimes is still not 100% compatible cross browser with other versions of itself and/or other libraries. Or it may be simply a problem with the slider code in and of itself.

All that said, here's the 'working' noConflict version of all.js:

4188

You may use it followed by:


<script type="text/javascript">jQuery.noConflict();</script>

But, as I say - I recommend scrapping it and most of the scripts on the page. Rethink what you're doing script wise and try to find a smaller amount of truly cross browser code for your purposes.

How did you end up picking all these scripts and code anyway?

kaushal
11-09-2011, 09:16 AM
Thank you Jscheuer for your all help. I really appriciate your help.
You are awesome. Now all the thing is working correctly.

Actually my client wanted this kind of slider. I searched through the web a lot but unfortunately I could not get.

So finally I got this js file directly from "http://www.vogue.com/parties/desiree-rogers-hosts-dinner-at-chicagos-pump-room/". So my slider started working but initially I did not look for this problem then client told me.

Now with your modified file, all the things are working properly.

Thank you very very much Jscheuer.