Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/01/2012, 18:54
moniliformis
 
Fecha de Ingreso: enero-2012
Mensajes: 3
Antigüedad: 12 años, 3 meses
Puntos: 0
Pregunta Problema carga carrusel: imágenes apiladas

Hola a todos,
Resulta que en la página donde quiero poner un carrusel de jquery, éste se carga mal: no funciona y las imágenes aparecen apiladas. No sé si se trata de algún conflicto o no, pero esto ya no lo sé solucionar sólo. Gracias por la ayuda que me podáis prestar.
Aquí está el código html:

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Fixed Header &amp; Footer: Cross Browser</title>
  5. <link href="css/estilo.css" rel="stylesheet" type="text/css" />
  6.  
  7.  
  8. <script type="text/javascript" src="js/jquery.js"></script> >
  9.     jQuery.noConflict();
  10.  
  11.     jQuery.fn.infiniteCarousel = function () {
  12.  
  13.     function repeat(str, num) {
  14.         return new Array( num + 1 ).join( str );
  15.     }
  16.  
  17.     return this.each(function () {
  18.         var jQuery.wrapper = jQuery('> div', this).css('overflow', 'hidden'),
  19.             jQuery.slider = jQuery.wrapper.find('> ul'),
  20.             jQuery.items = jQuery.slider.find('> li'),
  21.             jQuery.single = jQuery.items.filter(':first'),
  22.            
  23.             singleWidth = jQuery.single.outerWidth(),
  24.             visible = Math.ceil(jQuery.wrapper.innerWidth() / singleWidth), // note: doesn't include padding or border
  25.             currentPage = 1,
  26.             pages = Math.ceil(jQuery.items.length / visible);            
  27.  
  28.  
  29.         // 1. Pad so that 'visible' number will always be seen, otherwise create empty items
  30.         if ((jQuery.items.length % visible) != 0) {
  31.             jQuery.slider.append(repeat('<li class="empty" />', visible - (jQuery.items.length % visible)));
  32.             jQuery.items = jQuery.slider.find('> li');
  33.         }
  34.  
  35.         // 2. Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
  36.         jQuery.items.filter(':first').before(jQuery.items.slice(- visible).clone().addClass('cloned'));
  37.         jQuery.items.filter(':last').after(jQuery.items.slice(0, visible).clone().addClass('cloned'));
  38.         jQuery.items = jQuery.slider.find('> li'); // reselect
  39.        
  40.         // 3. Set the left position to the first 'real' item
  41.         jQuery.wrapper.scrollLeft(singleWidth * visible);
  42.        
  43.         // 4. paging function
  44.         function gotoPage(page) {
  45.             var dir = page < currentPage ? -1 : 1,
  46.                n = Math.abs(currentPage - page),
  47.                left = singleWidth * dir * visible * n;
  48.            
  49.            jQuery.wrapper.filter(':not(:animated)').animate({
  50.                scrollLeft : '+=' + left
  51.            }, 500, function () {
  52.                if (page == 0) {
  53.                    jQuery.wrapper.scrollLeft(singleWidth * visible * pages);
  54.                    page = pages;
  55.                } else if (page > pages) {
  56.                     jQuery.wrapper.scrollLeft(singleWidth * visible);
  57.                     // reset back to start position
  58.                     page = 1;
  59.                 }
  60.  
  61.                 currentPage = page;
  62.             });                
  63.            
  64.             return false;
  65.         }
  66.        
  67.         jQuery.wrapper.after('<a class="arrow back">&lt;</a><a class="arrow forward">&gt;</a>');
  68.        
  69.         // 5. Bind to the forward and back buttons
  70.         jQuery('a.back', this).click(function () {
  71.             return gotoPage(currentPage - 1);                
  72.         });
  73.        
  74.         jQuery('a.forward', this).click(function () {
  75.             return gotoPage(currentPage + 1);
  76.         });
  77.        
  78.         // create a public interface to move to a specific page
  79.         jQuery(this).bind('goto', function (event, page) {
  80.             gotoPage(page);
  81.         });
  82.     });  
  83. };
  84.  
  85. jQuery(document).ready(function () {
  86.   jQuery('.infiniteCarousel').infiniteCarousel();
  87. });
  88. <link href="css/estil.css" rel="stylesheet" type="text/css" />
  89. <!--[if IE 6]>
  90. <link href="css/ie6.css" rel="stylesheet" type="text/css" />
  91. <![endif]-->
  92. <script language="JavaScript" type="text/JavaScript">
  93. <!--
  94. function MM_preloadImages() { //v3.0
  95.  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  96.    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  97.    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  98. }
  99.  
  100. function MM_findObj(n, d) { //v4.01
  101.  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  102.    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  103.  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  104.  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  105.  if(!x && d.getElementById) x=d.getElementById(n); return x;
  106. }
  107.  
  108. function MM_nbGroup(event, grpName) { //v6.0
  109.  var i,img,nbArr,args=MM_nbGroup.arguments;
  110.  if (event == "init" && args.length > 2) {
  111.    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
  112.      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
  113.      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
  114.      nbArr[nbArr.length] = img;
  115.      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
  116.        if (!img.MM_up) img.MM_up = img.src;
  117.        img.src = img.MM_dn = args[i+1];
  118.        nbArr[nbArr.length] = img;
  119.    } }
  120.  } else if (event == "over") {
  121.    document.MM_nbOver = nbArr = new Array();
  122.    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
  123.      if (!img.MM_up) img.MM_up = img.src;
  124.      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
  125.      nbArr[nbArr.length] = img;
  126.    }
  127.  } else if (event == "out" ) {
  128.    for (i=0; i < document.MM_nbOver.length; i++) {
  129.      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  130.  } else if (event == "down") {
  131.    nbArr = document[grpName];
  132.    if (nbArr)
  133.      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
  134.    document[grpName] = nbArr = new Array();
  135.    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
  136.      if (!img.MM_up) img.MM_up = img.src;
  137.      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
  138.      nbArr[nbArr.length] = img;
  139.  } }
  140. }
  141.  
  142. function MM_goToURL() { //v3.0
  143.  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  144.  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
  145. }
  146. //-->
  147. </head>
  148. <body onload="MM_preloadImages('imatges/barranaveg/inici2.jpg','imatges/barranaveg/serveis2.jpg','imatges/barranaveg/tarifa2.jpg','imatges/barranaveg/clients2.jpg','imatges/barranaveg/contacte2.jpg','Image1')">
  149. <body onLoad="MM_preloadImages('imatges/barranaveg/clients2.jpg','imatges/barranaveg/contacte2.jpg')">
  150.     <div id="page-background"><img src="imatges/logobo.jpg" alt="Smile" name="Image1" width="100%" height="100%">
  151.       <table id="content"; border="0" align="center" cellpadding="0" cellspacing="0">      
  152.           <td><a href="blanc.htm" target="_top" onclick="MM_goToURL('parent','blanc.htm');return document.MM_returnValue;MM_nbGroup('down','group1','inici1','',1)" onMouseOver="MM_nbGroup('over','inici1','imatges/barranaveg/inici2.jpg','Image1',1)" onMouseOut="MM_nbGroup('out')"><img src="imatges/barranaveg/inici1.jpg" alt="" name="inici1" width="100%" height="34" border="0"></a></td>
  153.           <td><a href="javascript:;" onMouseOver="MM_nbGroup('over','serveis1','imatges/barranaveg/serveis2.jpg','Image1','imatges/barranaveg/serveis2.jpg',1)" onMouseOut="MM_nbGroup('out')"><img src="imatges/barranaveg/serveis1.jpg" alt="" name="serveis1" width="100%" height="34" border="0" onload=""></a></td>
  154.           <td><a href="javascript:;" onMouseOver="MM_nbGroup('over','tarifa1','imatges/barranaveg/tarifa2.jpg','Image1','imatges/barranaveg/tarifa2.jpg',1)" onMouseOut="MM_nbGroup('out')"><img src="imatges/barranaveg/tarifa1.jpg" alt="" name="tarifa1" width="100%" height="34" border="0" onload=""></a></td>
  155.           <td><a href="javascript:;" onMouseOver="MM_nbGroup('over','clients1','imatges/barranaveg/clients2.jpg','Image1','imatges/barranaveg/clients2.jpg',1)" onMouseOut="MM_nbGroup('out')"><img src="imatges/barranaveg/clients1.jpg" alt="" name="clients1" width="100%" height="34" border="0" onload=""></a></td>
  156.           <td><a href="javascript:;" onMouseOver="MM_nbGroup('over','contacte1','imatges/barranaveg/contacte2.jpg','Image1','imatges/barranaveg/contacte2.jpg',1)" onMouseOut="MM_nbGroup('out')"><img src="imatges/barranaveg/contacte1.jpg" alt="" name="contacte1" width="100%" height="34" border="0" onload=""></a></td>
  157.     </table>
  158. </div>
  159. <!-- <div id="ie6pagewrap"> -->
  160. <div id="ie6pagecontainer">
  161.     <div id="page-background2"><img src="imatges/fonsbo.jpg" width="100%" height="100%" alt="Smile" /> </div>  
  162.     <div id="content2" align="center">
  163.                 <h1>Sed ut perspiciatis unde</h1>
  164.         <div class="carouselc" id="carouselc">
  165.         <h1>Infinite Carousel</h1>
  166.          
  167.         <div class="Carousel Infinito">
  168.           <div style="overflow: hidden;" class="wrapper">
  169.             <ul>
  170.               <li class="cloned"><a href="http://www.tutorialesenlaweb.com" title="Tutoriales en la Web"><img src="imagenes/1.jpg" alt="Tutoriales en la web" width="85" height="85"></a></li>
  171.          
  172.                   <li class="cloned"><a href="http://www.tutorialesenlaweb.com" title="Tutoriales en la Web"><img src="imagenes/2.jpg" alt="Tutoriales en la web" width="85" height="85"></a></li>
  173.          
  174.  
  175.             </ul>
  176.               </div><a class="arrow back">&lt;</a><a class="arrow forward">&gt;</a>
  177.         </div>
  178.         </div>
  179.                
  180.                 <h1>Lorem ipsum dolor sit amet</h1>
  181.                
  182.  
  183.     </div>
  184.      <!--END CONTENT2-->                
  185. </div>
  186.  
  187. <!-- </div> -->
  188. </body>
  189. </html>