I have a problem ...
JS
$('#Contact').ready(function(){
$('a#Contact-Map').live('click',function(event){
event.preventDefault();
$('a#Contact-Map').fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'speedIn' : 600,
'speedOut' : 200,
'overlayShow' : true
});
});
});
HTML
<div class="Module-Frame" id="Contact">
<a id="Contact-Map" href="./Modules/Contact/Images/mapa_big.png">
<img src="./Modules/Contact/Images/mapa.png" alt=""/>
</a>
</div>
This HTML code is loaded by .load() jQuery function. That's working but only when you click this image twice ...
Help pls :)
JS with load() func
$(document).ready(function(){ $("#Menu").children().click(function(event){ $("#Content").hide().load('./Modules/'+ event.target.id.substr(5) +'/index.php', function() { $(this).fadeIn(); }); }); });
HTML
< html > < head > ... ... <body> ... <div id="Menu"> <a id="Menu-News" href="#" title="Aktualnosci"> aktualności | <a id="Menu-Aboutus" href="#" title="O nas"> o nas | <a id="Menu-Contact" href="#" title="Kontakt"> kontakt | <a id="Menu-Gallery" href="#" title="Galeria"> galeria </div> ... < div id=#content> ...
After many hours I solved the problem simply by change:
$(this).fancybox({
to:
$.fancybox(this,{
$('#Contact').ready(function(){ $('a#Contact-Map').live('click',function(event){ event.preventDefault(); $.fancybox(this,{ 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'speedIn' : 600, 'speedOut' : 200, 'overlayShow' : true }); }); });