Ho 2 pagine, il mio index.html e social.html. Ho pulito il mio indice e lasciato solo il codice jquery necessario per fancybox Quello che sto cercando di fare è avere immagini all'interno di social.html e quando cliccato su di esso, si aprirà fancybox e lo mostrerà ma in index.html non all'interno dell'iframe . L'errore che viene in su è:chiama Fancybox in parent from iframe
Uncaught TypeError: Property 'showImage' of object [object DOMWindow] is not a function
(anonymous function)social.html:103
onclick
questo è il mio index.html:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript" src="js/video.js"></script>
<script type="text/javascript">
function showImage(image) {
$.fancybox('<img src="img/' + image + '" alt="" border="0" />');
};
</script>
</head>
<body>
<iframe src="social.html" scrolling="no" border="0" width="579" height="505" allowtransparency="true"></iframe>
</body>
</html>
nella pagina IFrame:
<img src="img/picture1.jpg" alt="" class="thumbs" onclick="parent.showImage('picture1.jpg');"/>
PS: entrambe le pagine sono sullo stesso dominio ... EDIT: video.js -> questo è da fancybox non l'ho fatto.
jQuery(document).ready(function() {
$(".video").click(function() {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 640,
'height' : 385,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'allowfullscreen' : 'true'
}
});
return false;
});
});
dovrebbe funzionare bene. – ShankarSangoli
questo è quello che ho pensato ma non continua a darmi quell'errore: S – Andres
Cosa c'è dentro 'js/video.js'. Se questo js ha qualche errore della funzione 'showImage' non verrà analizzato dal motore JS del browser. E solo in quel caso verrà generato questo errore. – ShankarSangoli