Reputation: 31
Basically, i want to toggle an image with a flash file on click of a button. I want to show image in the beginning but want it to replaced by flash file. Also, i want the original image to show again on the click of the same button..
Upvotes: 3
Views: 2880
Reputation: 490607
var container = $('#container'),
image = container.find('img'),
flash = container.find('object'),
button = $('#my-button');
image.hide();
put_flash_in();
button.click(function() {
if (image.is(':visible')) {
image.hide();
flash.show();
} else {
image.show();
flash.hide();
}
});
Upvotes: 3
Reputation: 31882
Something like this should work:
<div>
<div id="image" style="display:block;">PLACE IMAGE HERE</div>
<div id="flash" style="display:none;">PLACE FLASH HERE</div>
</div>
<div onclick="$('#image').toggle();$('#flash').toggle()">click me</div>
Upvotes: 3