slideshow numero immagini

cristipe

Nuovo Utente
12 Nov 2009
15
0
0
Buongiorno a tutti
ringrazio chi potrà aiutarmi. Questa galleria di immagini mi permette di visualizzare al massimo 4 immagini potreste dirmi che variabile devo inserire per poter vedere un numero maggiore di immagini grazie a tutti

<div id='slideshow'>
<img src='./imgs/1.jpg' alt='Test photo' title='unique' />
<img src='./imgs/2.jpg' alt='Test photo' title='unique' />
<img src='./imgs/3.jpg' alt='Test photo' title='unique' />
<img src='./imgs/4.jpg' alt='Test photo' title='unique' />

<script type="text/jscript">
$("#slideshow").imageFading({

loading: "Loading Unique images..."
, fadetime: 1000
, over: true
});
</script>


( function( $ ) {
$.fn.imageFading = function ( options ) {
return this.each( function() {
var $this = $( this );
var over = false;

// set parameters
var opt = $.extend(
{
showtime: 3000
, loading: "Loading images..."
, fadetime: 3000
, caption: false
, captioncss: {}
, over: true

}
, options || {}
);

// mouse over event
if ( opt.over ) {
$this.hover(
function () { over = true; }
, function () { over = false; }
);
}

// set container css
if ( $this.css( "overflow" ) != "hidden" ) {
$this.css({ "overflow": "hidden" });
}

// hide all images
$this.children().css({
position: "absolute"
, "z-index": "-1"
, "margin-top": "0px"
, "margin-left": "0px"
, "max-height": $this.height() + "px"
, "max-width": $this.width() + "px"
}).hide();

// print loading
$this.append(
"<div style='clear:both; padding: 0px; margin: 0px;' id='loading'>" + opt.loading + "</div>"
);

// preload images
var loadImgs = 0;
$( "img" , $this ).each(
function () {
var img = new Image();
var soc = $( this ).attr( 'src' );

$( img ).load(
function () {
loadImgs++;
}
).attr( "src" , soc );
}
);

var ie7 = navigator.userAgent.match(/MSIE 7/i);

var totImgs = $( "img" , $this ).length;
var intVal = window.setInterval(
function () {
if ( loadImgs == totImgs ) {
window.clearInterval( intVal );
$( "#loading" ).remove();

if ( opt.caption ) {
$this.append( "<div id='caption'></div>" );
var ht = parseInt ( opt.captioncss.height || 20 );
var pg = parseInt ( opt.captioncss.padding || 5 );

$( "#caption" ).css({
"position": ( ie7 ? "relative" : "absolute" )
, "z-index": parseInt ( $this.css( "z-index" ) ) + 5 || 10
, "width": ( $this.width() - ( pg * 2 ) ) + "px"
, "height": ( opt.captioncss.height || ( ht - ( pg * 2 ) ) ) + "px"
, "color": opt.captioncss.color || "#fff"
, "font": opt.captioncss.font || "10px Helvetica"
, "background": opt.captioncss.background || "#000"
, "margin-top": ( opt.captioncss.marginTop || ( $this.height() - ht ) ) + "px"
, "padding": pg + "px"
, "opacity": opt.captioncss.opacity || 0.7
, "text-align": opt.captioncss.align || "left"
, "display": "none"
});
}

$this.children( ":eq(0)" )
.css({
"margin-top": ( ( $this.height() - $this.children( ":eq(0)" ).height() ) / 2 ) + "px"
, "margin-left": ( ( $this.width() - $this.children( ":eq(0)" ).width() ) / 2 ) + "px"
})
.fadeIn( parseInt ( opt.fadetime ) );
$( "#caption" ).html( $this.children( ":eq(0)" ).attr( "title" ) ).fadeIn( parseInt ( opt.fadetime ) );

if ( totImgs > 1 ) { fadeStart( $this , opt , totImgs ); }
}
}
, 100
);

function fadeStart ( $this , opt , totImgs ) {
var cnt = 0;
var intVal = window.setInterval(
function () {
if ( ! over ) {
$( $this ).children( ":eq(" + cnt + ")" ).fadeOut( parseInt ( opt.fadetime ) );
setTimeout( function () { $( "#caption" ).html( "" ) } , parseInt ( opt.fadetime / 4 ) );

if ( ( cnt + 1 ) == totImgs ) {
cnt = 0;
} else {
cnt++;
}

$( $this ).children( ":eq(" + cnt + ")" )
.css({
"margin-top": ( ( $this.height() - $this.children( ":eq(" + cnt + ")" ).height() ) / 2 ) + "px"
, "margin-left": ( ( $this.width() - $this.children( ":eq(" + cnt + ")" ).width() ) / 2 ) + "px"
})
.fadeIn(
parseInt ( opt.fadetime )
, function () {
if ( opt.caption ) {
$( "#caption" ).html( $this.children( ":eq(" + cnt + ")" ).attr( "title" ) );
}
}
);
}
}
, parseInt ( opt.showtime ) + parseInt ( opt.fadetime )
);
}
});
};
})(jQuery);
PHP:
 

MAeSI

Utente Attivo
13 Apr 2014
71
1
8
quellidelcucuzzolo.blogspot.it
Ciao, dovrebbe bastare inserire un nuovo elemento <img> nel div con id slideshow (che non hai chiuso).

ps: penso che tu abbia riportato male il codice dello script nel post, perché ci sono alcuni errori.
 

cristipe

Nuovo Utente
12 Nov 2009
15
0
0
Ciao, dovrebbe bastare inserire un nuovo elemento <img> nel div con id slideshow (che non hai chiuso).

ps: penso che tu abbia riportato male il codice dello script nel post, perché ci sono alcuni errori.

grazie mille per la risposta, in effetti il div era chiuso ma non l'ho riportato.
avevo fatto un errore nel nominare le immagini e quindi non me le leggeva, ora funziona. approfitto della tua gentilezza per chiederti come posso togliere lo spazio che si presenta sul top e il down delle immagini
grazie mille
 

MAeSI

Utente Attivo
13 Apr 2014
71
1
8
quellidelcucuzzolo.blogspot.it
come posso togliere lo spazio che si presenta sul top e il down delle immagini

Utilizzando solo lo script le immagini si centrano orizzontalmente e verticalmente rispetto al loro contenitore.
Avrai sicuramente un CSS che regola tali impostazioni.

hai trovato altri errori per caso?

Il secondo script non è tra i tag <script> e l'ordine va invertito... ma se ti funziona probabilmente l'hai riportato male qui sul forum.
 
Discussioni simili
Autore Titolo Forum Risposte Data
Z Slideshow automatico HTML e CSS 0
Z CSS Slideshow senza JS e JQUERY HTML e CSS 2
Z CSS Slideshow senza JS e JQUERY HTML e CSS 2
F [PHP] Slideshow video PHP 0
Cosina Aggiungere pulsante pause/play a slideshow Javascript 0
ANDREA20 [Javascript] Slideshow Gallery Javascript 0
Andrea_Ventura [HTML] Creare un DIV con slideshow HTML e CSS 5
I [HTML] Slideshow si sovrappone a <div> HTML e CSS 14
I [CSS3]Problema slideshow multiple HTML e CSS 2
M [HTML] Slideshow immagini con effetto FADE HTML e CSS 2
V Creare slideshow con immagini esterne Ajax 1
dakko96 slideshow doppia jQuery 0
G Aiuto slideshow joomla3x Joomla 4
R Slideshow di immagini in HTML5 HTML e CSS 1
S Slideshow con jquery Javascript 2
S Slideshow immagini automatica senza specificare il file immagine PHP 7
I Slideshow HTML e CSS 4
L SlideShow in js Javascript 1
A problema slideshow con visualizzazione mobile HTML e CSS 6
F Plugin Metaslider (Slideshow Wordpress) WordPress 1
Devil-94 javascript slideshow Javascript 1
D Come far ripartire una gif quando si rivisita la pagina dello slideshow WordPress 1
Emix Slideshow con div sovrapposto HTML e CSS 5
J Slideshow e gallerie manuali HTML e CSS 19
G Slideshow e Posizionamento DIV HTML e CSS 8
F Codice Random Javascript con slideshow Javascript 3
S Problemi con slideshow HTML e CSS 0
M Simple Slideshow jQuery 1
R Errore Slideshow - "Attenzione lo script non risponde" Joomla 1
R Uso Immagini per Slideshow Joomla 0
R Immagini con Link (modulo e slideshow) Joomla 0
C aggiungere link foto slideshow HTML e CSS 2
K Aiuto per slideshow HTML e CSS 4
L Slideshow non cambia le foto Flash 7
G problema caricamento condizionale slideshow FlexSlider Javascript 0
M [RISOLTO]Fermare slideshow immagini al passaggio del mouse. jQuery 3
L jquery slideshow con anteprima jQuery 10
F Slideshow Javascript 0
P Slideshow orrizontale con link WordPress 0
M sezione news del mio sito collegata a uno slideshow nella home page PHP 0
P Bug IE 7/8 slideshow inserito in pagina html5 Parallax HTML e CSS 4
P Bug IE 7 slideshow inserito in pagina html5 Parallax Javascript 1
M Come dire al mio slideshow di non scrollare all'infinito! jQuery 23
F aiuto slideshow Javascript 0
F personalizzazione slideshow Javascript 0
L Banner e slideshow Flash 1
P Slideshow per sito in ASP Classic ASP 0
J creazione di un slideshow con pagine html HTML e CSS 3
T conflitto tra due slideshow Javascript 3
T inserimento url su immagini in slideshow Javascript 4

Discussioni simili