[OpenLayers-Users] OpenLayers and JQuery

Norman Barker norman.barker at gmail.com
Thu Dec 4 17:21:25 EST 2008


thanks for the tip, building the single file version of OpenLayers
rather than using lib/OpenLayers.js solved the problem and I am
working again!

After building the single file version of OpenLayers I was able to
remove the jquery noConflicts function and everything works fine.



On Thu, Dec 4, 2008 at 1:44 PM, Amos Hayes <ahayes at gcrc.carleton.ca> wrote:
> That's odd Norman. I'm using the latest OpenLayers and JQuery together on
> the same page without issue and without doing anything special to avoid
> conflict. The basic features of OpenLayers that I'm using work fine, and I'm
> able to use the $() function as is. I am loading the Google and OpenLayers
> scrips before I load jQuery. I don't load prototype separately and I'm
> working with the single file version of OpenLayers.
> I wonder if you are having global variable issues.
> I've followed this guide to compartmentalize my code and isolate the things
> I create from the global namespace. Have a look at it and the article
> referenced by it.
> http://yuiblog.com/blog/2007/06/12/module-pattern/
> Might not be related, but seems to be good procedure. Hope that helps!
> --
> Amos Hayes
> Geomatics and Cartographic Research Centre
> Carleton University
> ahayes at gcrc.carleton.ca
> +1.613.520.2600x8179
> On 4-Dec-08, at 1:29 PM, Norman Barker wrote:
>> Hi,
>> I would like to use OpenLayers and JQuery together.  I noted the
>> jquery and prototype library conflicts and have added
>> $j = jQuery.noConflict();
>> to make the $ function available to OpenLayers.
>> However on loading the page I get (with firebug)
>> str.indexOf is not a function
>> [Break on this error] return (str.indexOf(sub) != -1);
>> which is defined in OpenLayers BaseType.
>> Is there a workaround for the base types conflicts between OpenLayers
>> and JQuery?
>> Many thanks,
>> Norman
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users

More information about the Users mailing list