Ver Mensaje Individual
  #6 (permalink)  
Antiguo 21/11/2011, 09:45
Avatar de NnikoO
NnikoO
 
Fecha de Ingreso: agosto-2008
Ubicación: Rosario
Mensajes: 245
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Datos de la base en Pop Up Jquery

Igual no comprendo como generar un pop up por cada producto, porque la cantidad varia, no son fijos, los productos se cargan o se borran desde un admin. Yo lo que hago es generar justamente el popup por cada producto que se cargue, el tema es que en estos siempre toma los datos del ultimo producto cargado.

Aca te dejo el código "resumido" de productos.php:

Código PHP:
Ver original
  1. <!--[if lte IE 6]>
  2. <script type="text/javascript" src="js/supersleight-min.js"></script>
  3. <link href="css/ie6.css" rel="stylesheet" type="text/css" />
  4. <![endif]-->
  5. <script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
  6. <script type="text/javascript">
  7. $(document).ready(function(){
  8.     $('a.poplight[href^=#]').click(function() {
  9.         var popID = $(this).attr('rel');
  10.         var popURL = $(this).attr('href');             
  11.         var query= popURL.split('?');
  12.         var dim= query[1].split('&');
  13.         var popWidth = dim[0].split('=')[1];
  14.         $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><img src="imagenes/cerrarpopup.jpg" class="btn_close" title="Cerrar" alt="Cerrar" /></a>');
  15.         var popMargTop = ($('#' + popID).height() + 80) / 2;
  16.         var popMargLeft = ($('#' + popID).width() + 80) / 2;
  17.         $('#' + popID).css({
  18.             'margin-top' : -popMargTop,
  19.             'margin-left' : -popMargLeft
  20.         });
  21.         $('body').append('<div id="fade"></div>');
  22.         $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();
  23.        
  24.         return false;
  25.     });
  26.     $('a.close, #fade').live('click', function() {
  27.         $('#fade , .popup_block').fadeOut(function() {
  28.             $('#fade, a.close').remove();  
  29.     });    
  30.         return false;
  31.     });
  32. });
  33. </script>
  34. <script type="text/javascript">
  35. $(document).ready(function() {
  36.     $(".tab_content").hide();
  37.     $("ul.tabs li:first").addClass("active").show();
  38.     $(".tab_content:first").show();
  39.     $("ul.tabs li").click(function() {
  40.         $("ul.tabs li").removeClass("active");
  41.         $(this).addClass("active");
  42.         $(".tab_content").hide();
  43.         var activeTab = $(this).find("a").attr("href");
  44.         $(activeTab).fadeIn();
  45.         return false;
  46.     });
  47. });
  48. </script>
  49. </head>
  50.  
  51. <body>
  52.  
  53.                     <div class="tab_container">
  54. <!-- Vinos Tintos -->
  55.                         <div id="vinos_tintos" class="tab_content">
  56.                             <div class="titulos_productos"><img src="imagenes/titulo_vinostintos.png" width="117" height="24" alt="Vinos Tintos" /></div>
  57.                             <?php include("tintos.php"); ?>
  58.                         </div>
  59. <!-- Vinos Blancos -->
  60.                         <div id="vinos_blancos" class="tab_content">
  61.                             <div class="titulos_productos"><img src="imagenes/titulo_vinosblancos.png" width="139" height="24" alt="Vinos Blancos" /></div>
  62.                             <?php include("blancos.php"); ?>
  63.                         </div>
  64. <!-- Vinos Rosados -->
  65.                         <div id="vinos_rosados" class="tab_content">
  66.                             <div class="titulos_productos"><img src="imagenes/titulo_vinosrosados.png" width="138" height="24" alt="Vinos Rosados" /></div>
  67.                             <?php include("rosados.php"); ?>
  68.                       </div>
  69. <!-- Vinos Espumantes -->
  70.                         <div id="vinos_espumantes" class="tab_content">
  71.                             <div class="titulos_productos"><img src="imagenes/titulo_vinosespumantes.png" width="170" height="34" alt="Vinos Espumantes" /></div>
  72.                             <?php include("espumantes.php"); ?>
  73.                         </div>
  74. <!-- Whisky -->
  75.                         <div id="whisky" class="tab_content">
  76.                             <div class="titulos_productos"><img src="imagenes/titulo_whisky.png" width="76" height="32" alt="Whisky" /></div>
  77.                             <?php include("whisky.php"); ?>
  78.                         </div>
  79. <!-- Destilados y Aperitivos -->
  80.                         <div id="destilados_aperitivos" class="tab_content">
  81.                         <div class="titulos_productos"><img src="imagenes/titulo_destiladosaperitivos.png" width="231" height="37" alt="Destilados y Aperitivos" /></div>
  82.                             <?php include("destilados.php"); ?>
  83.                         </div>
  84.                     </div>                 
  85.                 </div>
  86.  
  87. </body>
  88. </html>