Salve a tutti,
stavo provando ad implementare un codice javascript per far apparire dei popup con testo dai link sulla mia pagina.
diciamo che i popup funzionano, in parte
il primo parte, ma gli altri non compaiono e resta solo l'overlay nero di sfondo.
L'unico modo per farli apparire e cliccarli in sequenza, in modo da sovrapporsi tutti.
Sapete dirmi come posso fare a sistemare tutto? anche un codice alternativo, un plugin jquery o non so... lascio sia il codice che il link per vedere l'anteprima (spero non sia un problema)
codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MobilyBlocks</title>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/mobilyblocks.js" type="text/javascript"></script>
<script src="js/init.js" type="text/javascript"></script>
</head>
<body>
<div id="content">
<div class="nature">
<ul class="reset">
[*][img]img/nature/img2.png[/img]
[*][img]img/nature/img3.png[/img]
[*][img]img/nature/img4.png[/img]
[*][img]img/nature/img5.png[/img]
[*][img]img/nature/img6.png[/img]
[*][img]img/nature/img2.png[/img]
[*][img]img/nature/img3.png[/img]
[/list]
</div>
</div>
<div id="bottom-banner">
Testo o immagine</p></div>
<div id="chisono" class="popup_block">
<h2>CHI SONO</h2>
I <3 Turtles.</p>
<div id="portfolio" class="popup_block">
<h2>PORTFOLIO</h2>
I <3 Turtles.</p>
</div>
<div id="contatti" class="popup_block">
<h2>CONTATTI</h2>
I <3 Turtles.</p>
</div>
<div id="name" class="popup_block">
<h2>Turtle Power</h2>
I <3 Turtles.</p>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
//When you click on a link with class of poplight and the href starts with a #
$('a.poplight[href^=#]').click(function() {
var popID = $(this).attr('rel'); //Get Popup Name
var popURL = $(this).attr('href'); //Get Popup href to define size
//Pull Query & Variables from href URL
var query= popURL.split('?');
var dim= query[1].split('&');
var popWidth = dim[0].split('=')[1]; //Gets the first query string value
//Fade in the Popup and add close button
$('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('[img]close_pop.png[/img]');
//Define margin for center alignment (vertical horizontal) - we add 80px to the height/width to accomodate for the padding and border width defined in the css
var popMargTop = ($('#' + popID).height() + 80) / 2;
var popMargLeft = ($('#' + popID).width() + 80) / 2;
//Apply Margin to Popup
$('#' + popID).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft
});
//Fade in Background
$('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies
return false;
});
//Close Popups and Fade Layer
$('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
$('#fade , .popup_block').fadeOut(function() {
$('#fade, a.close').remove(); //fade them both out
});
return false;
});
});
</script>
</body>
</html>
codice:
h t t p://w w w.cftest.netsons.org/io/index.h t m l