[Mapbender-dev] using jquery ...

Christoph Baudson (WhereGroup) christoph.baudson at wheregroup.com
Mon May 14 11:12:51 EDT 2007


I would be very interested in a solution. I use the jQuery library in a 
separate frame, but want to locate html elements in another iframe.

Until now I didn't succeed. In this example

 > imported_$('div.test a').find('span').each(function(i) { ...

the variable imported_$ only *points* to the jQuery library in the 
remote frame, so 'div.test a' will only find the div tags in the iframe 
where jQuery is loaded, and not in the intended iframe. At least that is 
my interpretation ;-)

I tried to clone the jQuery-object with my own recursive function, but 
the depth is too deep and I get a stack overflow.

Maybe we can do a debug sprint together sometime?

Christoph

Marc Jansen schrieb:
> Michael Schulz schrieb:
>> Hi,
>>
>> I remember from the mapbender dev meeting, that there were some
>> caveeats using the jquery library, since it is loaded through a
>> seperate iframe. Marc you pointed out a solution how to handle this
>> problem. My goal is to use jquery in another module iframe. 
> 
> Hi Michael,
> 
> you might try to map the jQuery functions:
> 
> e.g. the normal frame where you load jquery.js is called 'jquery_loader'
> 
> in another frame you can call jquery functions like this (untested, the 
> referencing of the document, wher jquery lives is surely wrong ;-)):
> 
> if (typeof window.frames['jquery_loader'].window.jQuery != 'undefined') {
>  var imported_$ = window.frames['jquery_loader'].window.jQuery;
>  alert(imported_$);
> } else {
>  alert('this seems to be a wrong reference...');
> }
> 
> you can then do something like this:
> 
> var my_links = imported_$('div.test a').find('span').each(function(i) {
>  alert(this.href);
> });
> 
> 
> Good luck....
> 
>> At the
>> moment I reference it twice (in jquery.html and in my module), that's
>> not how it's supposed to be.
>>
>> Anybody already done a slider zooming control (jQuery/interface)? I'd
>> be happy to share thoughts on this (e.g. functionality, customization,
>> etc.)
>>
>> Cheers, Michael
>>
> _______________________________________________
> Mapbender_dev mailing list
> Mapbender_dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapbender_dev



More information about the Mapbender_dev mailing list