-
Ciao a tutti,credo di avere un problema di javascript: se andate su newsliguria[punto]com potete notare che lo slider in home ha un caption che presenta un titolo e un excerpt (un riassunto del post) di wordpress. La cosa strana, è che se lo fate girare un pò di volte (le immagini che ruotano sono solo 4 ) i riassunti progressivamente spariscono, prima da uno solo, poi da due e infine vedete ruotare solo le immagini dei titoli.
A me non è mai capitato di vedere una malfunzionamento "progressivo", di solito le cose o vanno o non vanno!
Non so che pesci prendere, di seguito vi passo il codice .js che ho leggerissimamamente modificato dall' originale, per far ruotare le immagini e i captions, e il codiche php che genera la lista di immagini.$(document).ready(function() { //Execute the slideShow, set 4 seconds for each images slideShow(5000); }); function slideShow(speed) { //append a LI item to the UL list for displaying caption $('ul.slideshow').append('<li id="slideshow-caption" class="caption"><div class="slideshow-caption-container"><h3></h3><p></p></div></li>'); //Set the opacity of all images to 0 $('ul.slideshow li').css({opacity: 0.0}); //Get the first image and display it (set it to full opacity) $('ul.slideshow li:first').css({opacity: 1.0}); //Get the caption of the first image from REL attribute and display it .attr('alt') $('#slideshow-caption h3').html($('ul.slideshow li:first').find('a').attr('title')); $('#slideshow-caption p').html($('ul.slideshow li:first').find('span.descrip')); //Display the caption $('#slideshow-caption').css({opacity: 0.7, bottom:0}); //Call the gallery function to run the slideshow var timer = setInterval('gallery()',speed); //pause the slideshow on mouse over $('ul.slideshow').hover( function () { clearInterval(timer); }, function () { timer = setInterval('gallery()',speed); } ); } function gallery() { //if no IMGs have the show class, grab the first image var current = ($('ul.slideshow li.show')? $('ul.slideshow li.show') : $('#ul.slideshow li:first')); //Get next image, if it reached the end of the slideshow, rotate it back to the first image var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption')? $('ul.slideshow li:first') :current.next()) : $('ul.slideshow li:first')); //Get next image caption .attr('alt') var title = next.find('a').attr('title'); var desc = next.find('span.descrip'); //Set the fade in effect for the next image, show class has higher z-index next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000); //Hide the caption first, and then set and display the caption $('#slideshow-caption').animate({left:580}, 300, function () { //Display the content $('#slideshow-caption h3').html(title); $('#slideshow-caption p').html(desc); $('#slideshow-caption').animate({left:405}, 500); }); //Hide the current image current.animate({opacity: 0.0}, 1000).removeClass('show'); }<ul class="slideshow" > <?php $my_query = new WP_Query('showposts=4'); while ($my_query->have_posts()) : $my_query->the_post(); $belin = catch_that_image(); ?> <li <?php if($count == 0){ echo"class='show'";} else{ echo"";} $count++; ?> > <a href="<?php the_permalink(); ?>" title="<a href='<?php the_permalink(); ?>'><?php the_title(); ?></a>"> <img src="vuvuvu[punto]newsliguria[punto]com/resize.php?url=<?php echo $belin ?>&size=585x250c50" alt="" /></a> <span class="descrip"> <?php the_advanced_excerpt('length=160&use_words=0&no_custom=1&ellipsis=%26hellip;&exclude_tags=img'); ?></span> </li> <?php endwhile; ?> </ul>Un aiutino please!
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi