Reputation: 12472
First off this is my - Test Site
This is my testing playground for Google maps, I am not concerning myself with aesthetics. What I am having trouble with is getting some jQuery to fire when I click on a link inside of the info window. If you are familiar with Google Maps this is where I create my infowindow:
GEvent.addListener(marker,"click", function() {
map.openInfoWindow(point,'<div class="infoWindow">'+windowText+'\
'+<a href='#' class='showme' onclick='return false;'>Show Comments</a>+'\
</div>');
/*On click, show all the comments*/
$('.showme').live('click', function(){
//alert('hey');
$('.comment').toggle('slow');
});
});
To understand how it works, it might be easier just to view the source on the page. Originally I had instead of using a "live event" been doing a normal "on click" which did not work. I was assuming because the info window was its own environment apart from the main window.
This was wrong I believe when I tried the "live event" and it began to work in Chrome and FF. So now I am trying to understand why the click event doesn't work in any browser, and why the live event would work in everything but IE.
Does anyone have any input?
Thanks,
Levi
Edit:Sorry, if it wasn't clear the "show comments" link in the info window is where my trouble lies.
Upvotes: 1
Views: 2052
Reputation: 4313
Changing the live('click',...)
to live('mouseup', ...)
fixed it in my case.
Upvotes: 0
Reputation: 735
The livequery plugin seems to work in info windows with IE.
$('.showme').livequery(function(){
$(this).click(function(){
$('.comment').toggle('slow');
});
});
Upvotes: 0
Reputation: 25523
It seems there are some issues with using jquery's live() functionality with IE. There was a recommendation here to try bind instead. I've read in some other places that using a different mouse event can work as well, such as mouseup or mousedown. It definitely seems like an IE bug, though.
Upvotes: 2