IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

GreyBox chargement de ma page


Sujet :

JavaScript

  1. #21
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2006
    Messages : 72
    Par défaut
    Haaa y a du progrès, je te laisse aller voir la page ici

    http://www.jeunesse-satigny.ch/galer...on=photos&id=5

  2. #22
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Par défaut
    je viens de tester ça marche il manque juste l'image : navigate.png

    http://easynews.free.fr/mbox/images/navigate.png
    ainsi que :

    http://easynews.free.fr/mbox/images/loader.gif

    a placer dans le dossier images

    quand j'essaye d'accèder a http://www.jeunesse-satigny.ch/images/navigate.png

    elle n'éxiste pas

  3. #23
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2006
    Messages : 72
    Par défaut
    OK, je viens d'ajouter les 2 fichiers et c'est mieux.

    Par contre, c'est pas placé au bon endroit chez moi, le tableau dans lequel les photos sont est a moitié sur le menu de gauche.

    De plus quand j'ouvre une photo la flèche de droite est en dessous.

    Tu as cela aussi ?

  4. #24
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Par défaut
    justement je suis en train de regarder

  5. #25
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Par défaut
    trouvé ^^

    tu as repris le css a la lettre

    pour le décalage de ton tableau :

    supprime complètement ça

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    #titi {
    		width:600px;
    		position:absolute;
    		left:50%;
    		margin-left:-300px;
    		padding:10px;
    		border:1px solid #666;
    	}
    pour le reste du css essaye ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
     
    body,html{
    		margin:0px;
    		padding:0px;
    		width:100%;
    		height:100%;
    	}
    	.beforeOut{
    		width:27px;
    		height:25px;
    		background:url('images/navigate.png') 0px 0px;
    		float:left;
    	}
    	.beforeOutOver{
    		width:27px;
    		height:25px;
    		background:url('images/navigate.png') 0px -25px;
    		float:left;
    	}
     
    	.beforeOutClick{
    		width:27px;
    		height:25px;
    		background:url('images/navigate.png') 0px -50px;
    		float:left;
    	}
    	.nextOut{
    		width:27px;
    		height:25px;
    		background:url('images/navigate.png') -27px 0px;
    		float:left;
    	}
    	.nextOutOver{
    		width:27px;
    		height:25px;
    		background:url('images/navigate.png') -27px -25px;
    		float:left;
    	}
     
    	.nextOutClick{
    		width:27px;
    		height:25px;
    		background:url('images/navigate.png') -27px -50px;
    		float:left;
    	}
    	.close{
    		width:27px;
    		height:25px;
    		position:absolute;
    		right:20px;
    		top:4px;
    		background:url('images/navigate.png') 0px -131px;
    	}
    	.indicator{
    		height:25px;
    		padding-left:10px;
    		padding-right:10px;
    		line-height:25px;
    		text-align:center;
    		color:#666;
    		font-weight:bold;
    		float:left;
    		background:url('images/navigate.png') 0px -108px;
    	}
    	.toolbar{
    		width:120px;
    		position:absolute;
    		top:5px;
    		left:50%;
    		margin-left:-60px;
    		clear:both;
    	}
    	.navigate{
    		width:100%;
    		height:33px;
    		line-height:33px;
    		background:url('images/navigate.png') 0px -75px;
    		position: fixed;
    		top:10px;
    		left:0px;
    		/* et le patch pour IE */ 
    	  position : expression("absolute"); 
    	  width : expression("100%"); 
    	  top : expression(document.body.scrollTop + this.offsetHeight - this.offsetHeight); 
    	  left : expression("0px"); 
     
    	}
    	.imageInformation{
    		color:#666;
    		font-weight:bold;
    		float:left;
    		margin-left:20px;
    	}
    	.modal{
    		width:100%;
    		height:100%;
    		top:0px;
    		left:0px;
    		background-color:#000;
    		position:absolute;
    		filter:alpha(opacity=70);
    		-moz-opacity:.7;
    		opacity:.7;
    	}
    	.frameBugFlash{
    		position:absolute;
    		top:0px;
    		left:0px;
    		z-index:0;
    		width:100%;
    		height:100%;
    		border:0px;
    		filter:alpha(opacity=0);
    		-moz-opacity:.0;
    		opacity:.0;
    	}
    	.contentMain{
    		width:100%;
    		height:100%;
    		top:0px;
    		left:0px;
    		position: fixed;
    		/* et le patch pour IE */ 
    		  position : expression("absolute"); 
    		  width : expression("100%"); 
    		  top : expression(document.body.scrollTop + this.offsetHeight - this.offsetHeight); 
    		  left : expression("0px"); 
     
    	}
    	.contentImage{
    		border:3px solid #666;
    		background-color:#FFFFFF;
    		position:absolute;
    		padding:10px;
    	}
    	.imgHide{
    		filter:alpha(opacity=0);
    		-moz-opacity:.0;
    		opacity:.0;
    	}
    	.btnPlay{
    		width:34px;
    		height:33px;
    		background:url('images/navigate.png') -2px -158px;
    		position:absolute;
    		position:absolute;
    		left:50%;
    		margin-left:-120px;
    	}
    	.btnPause{
    		width:34px;
    		height:33px;
    		background:url('images/navigate.png') -2px -193px;
    		position:absolute;
    		position:absolute;
    		left:50%;
    		margin-left:-120px;
    	}

    et LE truc qui fait planter l'image en bas :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    * {
        font-family: Verdana, Helvetica;
        font-size: 10pt;
    }
    deux solution le virer ^^

    ou agrandir la zone toolbar

  6. #26
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2006
    Messages : 72
    Par défaut
    C'est fait !

    Point positif, c'est bien placé dans la page

    Points négatifs : on a plus le petit effet survol au passage de la souris, la flèche suivant est toujours a la ligne, et surtout quand je clique sur l'une des photos plus loin elle ne s'ouvre pas...

  7. #27
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2006
    Messages : 72
    Par défaut
    Citation Envoyé par le_chomeur Voir le message
    et LE truc qui fait planter l'image en bas :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    * {
        font-family: Verdana, Helvetica;
        font-size: 10pt;
    }
    deux solution le virer ^^

    ou agrandir la zone toolbar
    Heu pas compris ca....lol

    c'est ou ?

  8. #28
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Par défaut
    j'ai trouvé le pkoi du comment ....

    on repart a 0 :

    tu as plusieurs head et body dans ta page :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    </head>
    <body>
    <!-- phpmyvisites -->
    ...
    puis juste avant mon css :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <head>
    <script type="text/javascript" src="galerie.js"></script>
    <style type="text/css">
     
    body,html{
    remonte le style et le script dans le premier head

    n'oublis pas non plus de fermer la page en bas :

    enfin si tu veux toujours le petit effet de hover :

    juste ça en plus :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    	#titi img{
    		float:left;
    		border:1px solid #666;
    		padding:4px;
    		margin:5px;
    	}
    	#titi img:hover{
    		background-color:#99CCCC;
    	}

    ps : le *{...} se trouve dans ton style principal

  9. #29
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2006
    Messages : 72
    Par défaut
    Excellent.

    En effet ces problèmes de double <head> viennent des includes...

    Bref j'ai corrigé, et ca semble fonctionner.

    Encore 2 petits bug a signaler

    1. Si j'ouvre une image mais pas une de celle du début, vers la fin ou au milieux elle ne s'affiche pas. J'ai l'impression qu'en vérité elle s'affiche mais trop bas

    2. La petite flèche se remet a la ligne au bout de quelques images...

  10. #30
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Par défaut
    pour moi il s'agit d'un problème de style
    et de mise en page HTML ( j'ai testé le script sur des pages correctes au niveau structure html et aucun souçis ... )

  11. #31
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2006
    Messages : 72
    Par défaut
    J'ai nettoyé ma feuille de style, elle contenait des télément pour faire fonctionner Highslide (un truc comme Greybox)

    Maintenant la CSS est clean, et ma structure HTML aussi

    As tu testé ton script sur une galerie ou il y a plus de 12 images ?

    La flèche qui se met en bas c'est dès la 10ème image, vu qu'il y a un caractère de plus que 9...lol

    Et pour les photos qui ne s'affiche pas si tu clique sur la 20ème image tu verra qu'elle n'est qu'a demi visible...

  12. #32
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Par défaut
    je regarde tout ça

  13. #33
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2006
    Messages : 72
    Par défaut
    Citation Envoyé par le_chomeur Voir le message
    je regarde tout ça
    Merci m'sieur !!!

  14. #34
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Par défaut
    trouvé la solution je m'en occupe ce soir

  15. #35
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Par défaut
    salut ^^

    peux tu remplacer ton fichier js par celui ci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
     
    function mBox(conteneurImage,activatePreload){
    	//Les objets composant la barre de navigation
    	this.navigate = null;
    	this.toolbar = null;
    	this.next =  null;
    	this.before = null
     ;
    	this.close = null ;
    	this.indicator = null;
    	this.btnPlayStop = null;
    	this.imageInformation = null;
    	//La div + frame modale
    	this.contentMain = null;
    	this.contentImage = null;
    	this.frameBugFlash = null;
    	//Le tableau contenant toutes les images
    	this.arrayImage = new Array();
    	//Objet image courante
    	this.imgCurrent = null;
    	this.indexCurrent = 0 ;
    	//Boolean permettant d'activer ou non le diaporama
    	this.activateDiapo = false;
    	//Un timer pour l'effet de fading et un autre pour l'aggrandissement de la boite
    	this.timer = null;
    	this.timer2 = null;
    	this.timerDiapo = null;
    	this.timeBetwenDiapo = 5000;
    	this.x = 0;
    	this.y = 0 ;
    	this.largeur = 0 ;
    	this.hauteur = 0;
     
    	this.imgCurrent = null;
    	this.maxH = 0 ;
    	this.maxL = 0 ;
    	this.IsIE=!!document.all;
    	this.upL = false;
    	this.upH = false;
    	this.verifH = false;
    	this.verifL = false;
     
    	this.conteneur = conteneurImage;
    	this.css = null ;
    	this.imgLoader = null;
    	this.spanInfo = null; 
    	this.divError =  null; 
    	//Variable permettant ou non d'activer le preload
    	this.preload = (typeof(activatePreload)  != 'undefined') ? activatePreload:false;
    	//On initialise :)
    	this.init();
    }
     
    mBox.prototype.init = function(){
    	//récupération de toutes les images du conteneur et de la balise alt
    	this.getAllImage();
    	//Ajout de la frame pour passer au dessus des flash + le conteneur transparent
    	this.contentMain = this.newElement({"typeElement":"div","classeCss":"contentMain","parent":null});
    	this.frameBugFlash = this.newElement({"typeElement":"div","classeCss":"modal","parent":this.contentMain});
    	this.newElement({"typeElement":"iframe","classeCss":"frameBugFlash","parent":this.contentMain });
    	//Ajout du conteneur de l'image
    	this.contentImage =
     this.newElement({"typeElement":"div","classeCss":"contentImage","parent":this.contentMain});	
    	this.css = this.contentImage.style;
    	//Construction de la barre de navigation
    	this.navigate = this.newElement({"typeElement":"div","classeCss":"navigate","parent":null});
    	this.btnPlayStop = this.newElement({"typeElement":"div","classeCss":"btnPlay","parent":this.navigate});
    	this.imageInformation = this.newElement({"typeElement":"div","classeCss":"imageInformation","parent":this.navigate});
    	this.toolbar = this.newElement({"typeElement":"div","classeCss":"toolbar","parent":this.navigate});
    	this.before = this.newElement({"typeElement":"div","classeCss":"beforeOut","parent":this.toolbar});
     
    	var me = this;
    	this.before.onclick = function(){me.beforeImg()};
    	this.indicator = this.newElement({"typeElement":"div","classeCss":"indicator","parent":this.toolbar});
     
    	this.next =
     this.newElement({"typeElement":"div","classeCss":"nextOut","parent":this.toolbar});
    	this.next.onclick = function(){me.nextImg()};
    	this.close = this.newElement({"typeElement":"div","classeCss":"close","parent":this.navigate});
    	this.close.onclick = function(){me.hide([me.contentMain,me.navigate])};
    	;
    	this.btnPlayStop.onclick = function(){me.activateDiapo = (me.activateDiapo == false) ? true:false;me.btnPlayStop.className = (me.btnPlayStop.className == "btnPlay")?"btnPause":"btnPlay";me.diaporama()};
    	//Création de l'image de load
    	this.imgLoader = this.newElement({"typeElement":"img","classeCss":"","parent":this.contentImage});
    	this.imgLoader.src = "images/loader.gif";
     
    	//On masque les éléments principaux
    	this.hide([this.navigate,this.contentMain,this.imgLoader]);
    }
     
    mBox.prototype.show = function(element){
    	if(element instanceof Array){
    		for(var i = 0 , l = element.length ; i <l ; i++){
     
    	element[i].style.display = "block";
    		}
    	}
    	else{
    		element.style.display = "block";
    	}
    }
     
    mBox.prototype.hide = function(element){
    	if(element instanceof Array){
    		for(var i = 0 , l = element.length ; i <l ; i++){
    			element[i].style.display = "none";
    		}
    	}
    	else{
    		element.style.display = "none";
    	}
    }
     
    mBox.prototype.seeCurent = function(numCurrent)
    {
    	//Index de l'image courante
    	this.indexCurrent = numCurrent;
    	//On tue les anciens timers
    	clearTimeout(this.timer);
    	clearTimeout(this.timer2);
    	//On supprimer l'ancienne image
    		this.removeImg();
    		this.show([this.navigate,this.contentMain]);
    		//On ajoute la nouvelle
    		this.createImg(this.arrayImage[this.indexCurrent]);
    		this.seeCurentPosition();
    }
     
    mBox.prototype.diaporama = function(){
    	var me =  this;
    	if(this.activateDiapo){
    		this.nextImg();
    		this.timerDiapo =
     setTimeout(function(){me.diaporama();},me.timeBetwenDiapo);
    	}
    	else{
    		 clearTimeout(this.timerDiapo);
    		 this.activateDiapo = false;
    	}
    }
    mBox.prototype.nextImg = function()
        {
          if(this.indexCurrent < (this.arrayImage.length-1)){this.indexCurrent++;}else{this.indexCurrent=0;}
     
          clearTimeout(this.timer);
          clearTimeout(this.timer2);
          this.removeImg();
          this.createImg(this.arrayImage[this.indexCurrent]);
          this.seeCurentPosition();
        }
     
        mBox.prototype.beforeImg = function()
        {
          if(this.indexCurrent > 0){this.indexCurrent--;}else{this.indexCurrent=(this.arrayImage.length-1);}
     
          clearTimeout(this.timer);
          clearTimeout(this.timer2);
          this.removeImg();
          this.createImg(this.arrayImage[this.indexCurrent]);
    	  this.seeCurentPosition();
        }
     
    mBox.prototype.createImg =
     function(iSrc)
    {
    	var me =  this ;
    	this.imgCurrent = document.createElement('img')
    	this.imgCurrent.className = "imgHide";	
    	this.imgCurrent.onerror = function(){me.MsgErreurShow();};
    	this.imgCurrent.src = iSrc;
    	this.imgCurrent.style.visibility = "hidden";
    	this.imgCurrent.id = "imgCurrent";
    	this.verifLoadImg();
    }
     
    mBox.prototype.removeImg = function()
    {
    	  if(this.imgCurrent!=null){
    		this.contentImage.removeChild(this.imgCurrent);
    	}
    }
     
    mBox.prototype.verifLoadImg = function() 
        {
     
    	  var temp = this ;
           if(this.imgCurrent.complete)
          {
    	  	if(this.imgCurrent.width != 0){
    			//On masque le message d'erreur et l'image de loading
    			this.hide(this.imgLoader);
    			//On tue le timer
    			clearTimeout(this.timer);
    			//Récupération de la taille de l'écran 
    			result=this.returnSize();
     
    			var myWidth=result[0];
    			var
     myHeight=result[1];
    			//test si l'image est plus grande en largeur ou hauteur :
    			if(myWidth < (this.imgCurrent.width+100) || myHeight < (this.imgCurrent.height+100)){
    				//On va récupérer les nouvelles valeur
    				var MaxSize = this.getMaxSizeDisplay(parseInt(myWidth/100*60),parseInt(myHeight/100*60));
    				this.maxL = MaxSize[0] + 20;
    				this.maxH = MaxSize[1] + 20;
    			}
    			else{
    				this.maxL = this.imgCurrent.width + 20;
    				this.maxH = this.imgCurrent.height + 20;
    			}
    			this.upL = (this.largeur <= this.maxL) ? true:false;
    			this.upH = (this.hauteur <= this.maxH) ? true:false;
    			this.verifH = false;
    			this.verifL = false;
    			this.openBox();
    		}
          }
          else
          {
    	  this.show(this.imgLoader);
            this.imgLoader.style.position = "absolute";
    	  this.imgLoader.style.top = "50%";
    	  this.imgLoader.style.left = "50%";
     
     this.imgLoader.style.marginLeft = -(parseInt(this.imgLoader.offsetWidth)/2) +"px" ;
            this.imgLoader.style.marginTop =- (parseInt(this.imgLoader.offsetHeight) /2) +"px";
            var temp = this;
            this.timer = setTimeout(function() {temp.verifLoadImg();}, 500);
          }
        }
     
    mBox.prototype.getMaxSizeDisplay = function(inMW, inMH)
    {
    	// inMW  : Largeur maximale
    	// inMH   : Hauteur maximale
    	var maxWidth = inMW;
    	var maxHeight = inMH;
    	// Declarations des variables "Nouvelle Taille"
    	var dW = 0;
    	var dH = 0;
    	// On recupere les tailles reelles
    	var h = dH = this.imgCurrent.height;
    	var w = dW = this.imgCurrent.width;
    	// Si la largeur ou la hauteur depasse la taille maximale
    	if ((h >= maxHeight) || (w >= maxWidth)) {
    	// Si la largeur et la hauteur depasse la taille maximale
    	if ((h >= maxHeight) && (w >= maxWidth)) {
    	  // On cherche la plus grande
     valeur
    	  if (h > w) {
    		dH = maxHeight;
    		// On recalcule la taille proportionnellement
    		dW = parseInt((w * dH) / h, 10);
    	  } else {
    		dW = maxWidth;
    		// On recalcule la taille proportionnellement
    		dH = parseInt((h * dW) / w, 10);
    	  }
    	} else if ((h > maxHeight) && (w < maxWidth)) {
    	  // Si la hauteur depasse la taille maximale
    	  dH = maxHeight;
    		// On recalcule la taille proportionnellement
    	  dW = parseInt((w * dH) / h, 10);
    	} else if ((h < maxHeight) && (w > maxWidth)) {
    	  // Si la largeur depasse la taille maximale
    	  dW = maxWidth;
    		// On recalcule la taille proportionnellement
    	  dH = parseInt((h * dW) / w, 10);
    	}
    	}
    	return new Array(dW,dH)
    }
     
    //Récupération de la taille de l'écran
    mBox.prototype.returnSize = function()
    {
    	var myWidth = 0, myHeight = 0;
    	if( typeof( window.innerWidth ) == 'number' ) 
    	{
     
    	//Non-IE
    		myWidth = window.innerWidth;
    		myHeight = window.innerHeight;
    	} 
    	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
    	{
    		//IE 6+ in 'standards compliant mode'
    		myWidth = document.documentElement.clientWidth;
    		myHeight = document.documentElement.clientHeight;
    	} 
    	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
    	{
    		//IE 4 compatible
    		myWidth = document.body.clientWidth;
    		myHeight = document.body.clientHeight;
    	}
    	var result = new Array(myWidth,myHeight);
    	return result;
    }
     
    mBox.prototype.openBox = function()
        {
    	  this.windowCenter(this.contentImage);
    	  /*
          if(this.largeur < this.maxL && this.upL)
          {
            this.largeur += 20 ;
            this.css.width = this.largeur + "px";
          }
          else
     if(this.largeur > this.maxL && !this.upL)
          {
            this.largeur -= 20 ;
            this.css.width = this.largeur + "px";
          }
          else
          {
            this.verifL = true;
          }
          if(this.hauteur < this.maxH && this.upH)
          {
            this.hauteur += 20 ;
            this.css.height = this.hauteur + "px";
          }
          else if(this.hauteur > this.maxH && !this.upH)
          {
            this.hauteur -= 20 ;
            this.css.height = this.hauteur + "px";
          }
          else
          {
            this.verifH = true;
            }
          */
          //if(this.verifH && this.verifL)
          //{
            this.css.width = this.maxL + "px";
            this.css.height = this.maxH +"px";
    		this.imgCurrent.style.width = this.maxL + "px";
    		this.imgCurrent.style.height = this.maxH + "px";
            this.windowCenter(this.contentImage);
     
     //clearTimeout(this.timer);
    	  this.imgCurrent.style.visibility = "visible";
            this.appendImg();
            this.fadePic(0,100,this.imgCurrent);
          //}
          /*else
          {
            this.windowCenter(this.contentImage);
            var temp = this;
            this.timer = setTimeout(function(){temp.openBox();},20);
          }*/
    }
     
    mBox.prototype.windowCenter = function(elementT) 
        {
          result=this.returnSize();
          var myWidth=result[0];
          var myHeight=result[1];
          var elementWidth=elementT.offsetWidth;
          var elementHeight=elementT.offsetHeight;
          var myScrollLeft=document.documentElement.scrollLeft;
          var myScrollTop=document.documentElement.scrollTop;
          var posX=myScrollLeft+myWidth-myWidth/2-elementWidth/2
          var posY=myScrollTop+myHeight-myHeight/2-elementHeight/2;
          elementT.style.left=posX+"px";
          elementT.style.top=posY+"px";
        }
     
     
    mBox.prototype.appendImg = function()
        {
    	  var temp = this;
          //Ajout de l'élément dans la div avec les tailles redimensionnée
    	  this.imgCurrent.style.width = this.maxL + "px";
    	  this.imgCurrent.style.height = this.maxH + "px";
          this.contentImage.appendChild(this.imgCurrent);
          this.windowCenter(this.imgCurrent);
          //Ajout du filtre
          if(this.IsIE)
          {
            this.imgCurrent.style.filter='alpha(opacity=0)';
            this.imgCurrent.filters[0].opacity=0;
          }
          else
          {
            this.imgCurrent.style.opacity='0';
          }
    	  //Nom de l'image
          //this.spanInfo.innerHTML = this.imgCurrent.src.substring(this.imgCurrent.src.lastIndexOf("\/")+1).split(".")[0]+"<br />";
        }
     
    mBox.prototype.fadePic = function(debut, fin , element)
        {
          if(debut==fin){return false}
     
     this.IsIE?element.filters[0].opacity=debut:element.style.opacity=debut/100;
          debut>fin?debut-=5:debut+=5;
          var temp  = this ;
          if(debut != fin)
          {
            this.timer2 = setTimeout(function(){temp.fadePic(debut,fin,element);},10);
          }
          else
          {
            clearTimeout(this.timer2);
          }
        }
     
    mBox.prototype.getAllImage = function(){
    	//On récupère toutes les images de notre liste , puis on ajoute au tableau toute les images des balises alt
    	var listeImg =  this.conteneur.getElementsByTagName('img');
    	var temp = this ;
    	var indexImg = 0 ;
    	for(var i = 0 , l = listeImg.length ; i < l ; i++){
    		//On ajoute l'image
    		this.arrayImage.push(listeImg[i].alt);
    		//On lui affecte une méthode sur le onclick pour l'afficher elle et une propriété indiquant son index
    		listeImg[i].indexImg = i ;
    		listeImg[i].onclick =
     function(){temp.seeCurent(this.indexImg);};
    		//Si le preload est activé
    		if(this.preload == true){
    			var imgTemp =  document.createElement('img');
    			imgTemp.src = listeImg[i].alt;
    		}
    	}
    }
     
      mBox.prototype.newElement = function (parameter){
    		var typeElement = parameter['typeElement'];
    		var classToAffect = parameter['classeCss'];
    		var parent = parameter['parent'];
     
    		var newElement = document.createElement(typeElement);
    		newElement.className = classToAffect;
    		if(parent == null){
    			document.body.appendChild(newElement);
    		}
    		else{
    			parent.appendChild(newElement);
    		}
    		return newElement;
    	}
     
    	mBox.prototype.seeCurentPosition = function(){
    		this.indicator.innerHTML =  (this.indexCurrent+1)+ " / " +this.arrayImage.length ;
    		this.imageInformation .innerHTML = this.imgCurrent.src.substring(this.imgCurrent.src.lastIndexOf("\/")+1).split(".")[0]
     
    	}

  16. #36
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2006
    Messages : 72
    Par défaut
    Salut,

    C'est fait...

    Ca change rien en apparence

  17. #37
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
     
    function mBox(conteneurImage,activatePreload){
    	//Les objets composant la barre de navigation
    	this.navigate = null;
    	this.toolbar = null;
    	this.next =  null;
    	this.before = null
     ;
    	this.close = null ;
    	this.indicator = null;
    	this.btnPlayStop = null;
    	this.imageInformation = null;
    	//La div + frame modale
    	this.contentMain = null;
    	this.contentImage = null;
    	this.frameBugFlash = null;
    	//Le tableau contenant toutes les images
    	this.arrayImage = new Array();
    	//Objet image courante
    	this.imgCurrent = null;
    	this.indexCurrent = 0 ;
    	//Boolean permettant d'activer ou non le diaporama
    	this.activateDiapo = false;
    	//Un timer pour l'effet de fading et un autre pour l'aggrandissement de la boite
    	this.timer = null;
    	this.timer2 = null;
    	this.timerDiapo = null;
    	this.timeBetwenDiapo = 5000;
    	this.x = 0;
    	this.y = 0 ;
    	this.largeur = 0 ;
    	this.hauteur = 0;
     
    	this.imgCurrent = null;
    	this.maxH = 0 ;
    	this.maxL = 0 ;
    	this.IsIE=!!document.all;
    	this.upL = false;
    	this.upH = false;
    	this.verifH = false;
    	this.verifL = false;
     
    	this.conteneur = conteneurImage;
    	this.css = null ;
    	this.imgLoader = null;
    	this.spanInfo = null; 
    	this.divError =  null; 
    	//Variable permettant ou non d'activer le preload
    	this.preload = (typeof(activatePreload)  != 'undefined') ? activatePreload:false;
    	//On initialise :)
    	this.init();
    }
     
    mBox.prototype.init = function(){
    	//récupération de toutes les images du conteneur et de la balise alt
    	this.getAllImage();
    	//Ajout de la frame pour passer au dessus des flash + le conteneur transparent
    	this.contentMain = this.newElement({"typeElement":"div","classeCss":"contentMain","parent":null});
    	this.frameBugFlash = this.newElement({"typeElement":"div","classeCss":"modal","parent":this.contentMain});
    	this.newElement({"typeElement":"iframe","classeCss":"frameBugFlash","parent":this.contentMain });
    	//Ajout du conteneur de l'image
    	this.contentImage =
     this.newElement({"typeElement":"div","classeCss":"contentImage","parent":this.contentMain});	
    	this.css = this.contentImage.style;
    	//Construction de la barre de navigation
    	this.navigate = this.newElement({"typeElement":"div","classeCss":"navigate","parent":null});
    	this.btnPlayStop = this.newElement({"typeElement":"div","classeCss":"btnPlay","parent":this.navigate});
    	this.imageInformation = this.newElement({"typeElement":"div","classeCss":"imageInformation","parent":this.navigate});
    	this.toolbar = this.newElement({"typeElement":"div","classeCss":"toolbar","parent":this.navigate});
    	this.before = this.newElement({"typeElement":"div","classeCss":"beforeOut","parent":this.toolbar});
     
    	var me = this;
    	this.before.onclick = function(){me.beforeImg()};
    	this.indicator = this.newElement({"typeElement":"div","classeCss":"indicator","parent":this.toolbar});
     
    	this.next =
     this.newElement({"typeElement":"div","classeCss":"nextOut","parent":this.toolbar});
    	this.next.onclick = function(){me.nextImg()};
    	this.close = this.newElement({"typeElement":"div","classeCss":"close","parent":this.navigate});
    	this.close.onclick = function(){me.hide([me.contentMain,me.navigate]);document.body.style.overflow="auto"};
    	;
    	this.btnPlayStop.onclick = function(){me.activateDiapo = (me.activateDiapo == false) ? true:false;me.btnPlayStop.className = (me.btnPlayStop.className == "btnPlay")?"btnPause":"btnPlay";me.diaporama()};
    	//Création de l'image de load
    	this.imgLoader = this.newElement({"typeElement":"img","classeCss":"","parent":this.contentImage});
    	this.imgLoader.src = "images/loader.gif";
     
    	//On masque les éléments principaux
    	this.hide([this.navigate,this.contentMain,this.imgLoader]);
    }
     
    mBox.prototype.show = function(element){
    	if(element instanceof Array){
    		for(var i = 0 , l = element.length ; i <l ; i++){
     
    	element[i].style.display = "block";
    		}
    	}
    	else{
    		element.style.display = "block";
    	}
    }
     
    mBox.prototype.hide = function(element){
    	if(element instanceof Array){
    		for(var i = 0 , l = element.length ; i <l ; i++){
    			element[i].style.display = "none";
    		}
    	}
    	else{
    		element.style.display = "none";
    	}
    }
     
    mBox.prototype.seeCurent = function(numCurrent)
    {
    	//Index de l'image courante
    	this.indexCurrent = numCurrent;
    	//On tue les anciens timers
    	clearTimeout(this.timer);
    	clearTimeout(this.timer2);
    	//On supprimer l'ancienne image
    		this.removeImg();
    		this.show([this.navigate,this.contentMain]);
    		//On supprime l'overflow de la page
    		document.body.style.overflow ="hidden";
    		//On ajoute la nouvelle
    		this.createImg(this.arrayImage[this.indexCurrent]);
    		this.seeCurentPosition();
    }
     
    mBox.prototype.diaporama = function(){
    	var me =  this;
    	if(this.activateDiapo){
    		this.nextImg();
    		this.timerDiapo =
     setTimeout(function(){me.diaporama();},me.timeBetwenDiapo);
    	}
    	else{
    		 clearTimeout(this.timerDiapo);
    		 this.activateDiapo = false;
    	}
    }
    mBox.prototype.nextImg = function()
        {
          if(this.indexCurrent < (this.arrayImage.length-1)){this.indexCurrent++;}else{this.indexCurrent=0;}
     
          clearTimeout(this.timer);
          clearTimeout(this.timer2);
          this.removeImg();
          this.createImg(this.arrayImage[this.indexCurrent]);
          this.seeCurentPosition();
        }
     
        mBox.prototype.beforeImg = function()
        {
          if(this.indexCurrent > 0){this.indexCurrent--;}else{this.indexCurrent=(this.arrayImage.length-1);}
     
          clearTimeout(this.timer);
          clearTimeout(this.timer2);
          this.removeImg();
          this.createImg(this.arrayImage[this.indexCurrent]);
    	  this.seeCurentPosition();
        }
     
    mBox.prototype.createImg =
     function(iSrc)
    {
    	var me =  this ;
    	this.imgCurrent = document.createElement('img')
    	this.imgCurrent.className = "imgHide";	
    	this.imgCurrent.onerror = function(){me.MsgErreurShow();};
    	this.imgCurrent.src = iSrc;
    	this.imgCurrent.style.visibility = "hidden";
    	this.imgCurrent.id = "imgCurrent";
    	this.verifLoadImg();
    }
     
    mBox.prototype.removeImg = function()
    {
    	try{
    	  if(this.imgCurrent!=null){
    		this.contentImage.removeChild(this.imgCurrent);
    	}
    	}
    	catch(err){}
    }
     
    mBox.prototype.verifLoadImg = function() 
        {
     
    	  var temp = this ;
           if(this.imgCurrent.complete)
          {
    	  	if(this.imgCurrent.width != 0){
    			//On masque le message d'erreur et l'image de loading
    			this.hide(this.imgLoader);
    			//On tue le timer
    			clearTimeout(this.timer);
    			//Récupération de la taille de l'écran 
    			result=this.returnSize();
     
    			var myWidth=result[0];
    			var
     myHeight=result[1];
    			//test si l'image est plus grande en largeur ou hauteur :
    			if(myWidth < (this.imgCurrent.width+100) || myHeight < (this.imgCurrent.height+100)){
    				//On va récupérer les nouvelles valeur
    				var MaxSize = this.getMaxSizeDisplay(parseInt(myWidth/100*60),parseInt(myHeight/100*60));
    				this.maxL = MaxSize[0] + 20;
    				this.maxH = MaxSize[1] + 20;
    			}
    			else{
    				this.maxL = this.imgCurrent.width + 20;
    				this.maxH = this.imgCurrent.height + 20;
    			}
    			this.upL = (this.largeur <= this.maxL) ? true:false;
    			this.upH = (this.hauteur <= this.maxH) ? true:false;
    			this.verifH = false;
    			this.verifL = false;
    			this.openBox();
    		}
          }
          else
          {
    	  this.show(this.imgLoader);
            this.imgLoader.style.position = "absolute";
    	  this.imgLoader.style.top = "50%";
    	  this.imgLoader.style.left = "50%";
     
     this.imgLoader.style.marginLeft = -(parseInt(this.imgLoader.offsetWidth)/2) +"px" ;
            this.imgLoader.style.marginTop =- (parseInt(this.imgLoader.offsetHeight) /2) +"px";
            var temp = this;
            this.timer = setTimeout(function() {temp.verifLoadImg();}, 500);
          }
        }
     
    mBox.prototype.getMaxSizeDisplay = function(inMW, inMH)
    {
    	// inMW  : Largeur maximale
    	// inMH   : Hauteur maximale
    	var maxWidth = inMW;
    	var maxHeight = inMH;
    	// Declarations des variables "Nouvelle Taille"
    	var dW = 0;
    	var dH = 0;
    	// On recupere les tailles reelles
    	var h = dH = this.imgCurrent.height;
    	var w = dW = this.imgCurrent.width;
    	// Si la largeur ou la hauteur depasse la taille maximale
    	if ((h >= maxHeight) || (w >= maxWidth)) {
    	// Si la largeur et la hauteur depasse la taille maximale
    	if ((h >= maxHeight) && (w >= maxWidth)) {
    	  // On cherche la plus grande
     valeur
    	  if (h > w) {
    		dH = maxHeight;
    		// On recalcule la taille proportionnellement
    		dW = parseInt((w * dH) / h, 10);
    	  } else {
    		dW = maxWidth;
    		// On recalcule la taille proportionnellement
    		dH = parseInt((h * dW) / w, 10);
    	  }
    	} else if ((h > maxHeight) && (w < maxWidth)) {
    	  // Si la hauteur depasse la taille maximale
    	  dH = maxHeight;
    		// On recalcule la taille proportionnellement
    	  dW = parseInt((w * dH) / h, 10);
    	} else if ((h < maxHeight) && (w > maxWidth)) {
    	  // Si la largeur depasse la taille maximale
    	  dW = maxWidth;
    		// On recalcule la taille proportionnellement
    	  dH = parseInt((h * dW) / w, 10);
    	}
    	}
    	return new Array(dW,dH)
    }
     
    //Récupération de la taille de l'écran
    mBox.prototype.returnSize = function()
    {
    	var myWidth = 0, myHeight = 0;
    	if( typeof( window.innerWidth ) == 'number' ) 
    	{
     
    	//Non-IE
    		myWidth = window.innerWidth;
    		myHeight = window.innerHeight;
    	} 
    	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
    	{
    		//IE 6+ in 'standards compliant mode'
    		myWidth = document.documentElement.clientWidth;
    		myHeight = document.documentElement.clientHeight;
    	} 
    	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
    	{
    		//IE 4 compatible
    		myWidth = document.body.clientWidth;
    		myHeight = document.body.clientHeight;
    	}
    	var result = new Array(myWidth,myHeight);
    	return result;
    }
     
    mBox.prototype.openBox = function()
        {
    	  //this.windowCenter(this.contentImage);
    	  /*
          if(this.largeur < this.maxL && this.upL)
          {
            this.largeur += 20 ;
            this.css.width = this.largeur + "px";
          }
          else
     if(this.largeur > this.maxL && !this.upL)
          {
            this.largeur -= 20 ;
            this.css.width = this.largeur + "px";
          }
          else
          {
            this.verifL = true;
          }
          if(this.hauteur < this.maxH && this.upH)
          {
            this.hauteur += 20 ;
            this.css.height = this.hauteur + "px";
          }
          else if(this.hauteur > this.maxH && !this.upH)
          {
            this.hauteur -= 20 ;
            this.css.height = this.hauteur + "px";
          }
          else
          {
            this.verifH = true;
            }
          */
          //if(this.verifH && this.verifL)
          //{
            this.css.width = this.maxL + "px";
            this.css.height = this.maxH +"px";
    		this.imgCurrent.style.width = this.maxL + "px";
    		this.imgCurrent.style.height = this.maxH + "px";
    		this.contentImage.style.left = 50+"%";
    		this.contentImage.style.marginLeft = -(this.contentImage.offsetWidth /2)+"px";
    		this.contentImage.style.top = 50+"%";
    		this.contentImage.style.marginTop = -(this.contentImage.offsetHeight /2)+"px";
            //this.windowCenter(this.contentImage);
     
     //clearTimeout(this.timer);
    	  this.imgCurrent.style.visibility = "visible";
            this.appendImg();
            this.fadePic(0,100,this.imgCurrent);
          //}
          /*else
          {
            this.windowCenter(this.contentImage);
            var temp = this;
            this.timer = setTimeout(function(){temp.openBox();},20);
          }*/
    }
     
    mBox.prototype.windowCenter = function(elementT) 
        {
          result=this.returnSize();
          var myWidth=result[0];
          var myHeight=result[1];
          var elementWidth=elementT.offsetWidth;
          var elementHeight=elementT.offsetHeight;
          var myScrollLeft=document.documentElement.scrollLeft;
          var myScrollTop=document.documentElement.scrollTop;
          var posX=myScrollLeft+myWidth-myWidth/2-elementWidth/2
          var posY=myScrollTop+myHeight-myHeight/2-elementHeight/2;
          elementT.style.left=posX+"px";
          elementT.style.top=posY+"px";
        }
     
     
    mBox.prototype.appendImg = function()
        {
    	  var temp = this;
          //Ajout de l'élément dans la div avec les tailles redimensionnée
    	  this.imgCurrent.style.width = this.maxL + "px";
    	  this.imgCurrent.style.height = this.maxH + "px";
          this.contentImage.appendChild(this.imgCurrent);
          this.windowCenter(this.imgCurrent);
          //Ajout du filtre
          if(this.IsIE)
          {
            this.imgCurrent.style.filter='alpha(opacity=0)';
            this.imgCurrent.filters[0].opacity=0;
          }
          else
          {
            this.imgCurrent.style.opacity='0';
          }
    	  //Nom de l'image
          //this.spanInfo.innerHTML = this.imgCurrent.src.substring(this.imgCurrent.src.lastIndexOf("\/")+1).split(".")[0]+"<br />";
        }
     
    mBox.prototype.fadePic = function(debut, fin , element)
        {
          if(debut==fin){return false}
     
     this.IsIE?element.filters[0].opacity=debut:element.style.opacity=debut/100;
          debut>fin?debut-=5:debut+=5;
          var temp  = this ;
          if(debut != fin)
          {
            this.timer2 = setTimeout(function(){temp.fadePic(debut,fin,element);},10);
          }
          else
          {
            clearTimeout(this.timer2);
          }
        }
     
    mBox.prototype.getAllImage = function(){
    	//On récupère toutes les images de notre liste , puis on ajoute au tableau toute les images des balises alt
    	var listeImg =  this.conteneur.getElementsByTagName('img');
    	var temp = this ;
    	var indexImg = 0 ;
    	for(var i = 0 , l = listeImg.length ; i < l ; i++){
    		//On ajoute l'image
    		this.arrayImage.push(listeImg[i].alt);
    		//On lui affecte une méthode sur le onclick pour l'afficher elle et une propriété indiquant son index
    		listeImg[i].indexImg = i ;
    		listeImg[i].onclick =
     function(){temp.seeCurent(this.indexImg);};
    		//Si le preload est activé
    		if(this.preload == true){
    			var imgTemp =  document.createElement('img');
    			imgTemp.src = listeImg[i].alt;
    		}
    	}
    }
     
      mBox.prototype.newElement = function (parameter){
    		var typeElement = parameter['typeElement'];
    		var classToAffect = parameter['classeCss'];
    		var parent = parameter['parent'];
     
    		var newElement = document.createElement(typeElement);
    		newElement.className = classToAffect;
    		if(parent == null){
    			document.body.appendChild(newElement);
    		}
    		else{
    			parent.appendChild(newElement);
    		}
    		return newElement;
    	}
     
    	mBox.prototype.seeCurentPosition = function(){
    		this.indicator.innerHTML =  (this.indexCurrent+1)+ " / " +this.arrayImage.length ;
    		this.imageInformation .innerHTML = this.imgCurrent.src.substring(this.imgCurrent.src.lastIndexOf("\/")+1).split(".")[0]
     
    	}

    code testé en local sur TA source html fonctionnelle ...
    j'ai juste supprimé l'effet d'ouverture , mais les autres problèmes sont règlés
    quelque soit la position l'image s'affiche corectement ...

  18. #38
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2006
    Messages : 72
    Par défaut
    Nickel, c'est réglé en effet.

    Reste juste cette petit flèche qui se met a la ligne dès la 10ème image...

    Et une petite question, a la place du nom du fichier (DSC00594) pas très intéressant, y a moyen de mettre la description de la galerie ?

    Ça se modifie ou ?

    Merci chef en tout vas...

  19. #39
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Par défaut
    pour la petite flèche qui se place en dessous :

    aumente la ligne :

    dans la class css toolbar a 160px

    pour le nom de l'image solution :

    dans la méthode :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    mBox.prototype.seeCurentPosition = function(){
    		this.indicator.innerHTML =  (this.indexCurrent+1)+ " / " +this.arrayImage.length ;
    		this.imageInformation .innerHTML = this.imgCurrent.src.substring(this.imgCurrent.src.lastIndexOf("\/")+1).split(".")[0]
    	}
    remplace par :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    this.imageInformation .innerHTML = this.galerieName;
    dans

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    function mBox(conteneurImage,activatePreload){
    	//Les objets composant la barre de navigation
    	this.navigate = null;
    ...
    ajoute une propriété :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    function mBox(conteneurImage,nameGalerie , activatePreload){
    this.galerieName = nameGalerie ;
    	//Les objets composant la barre de navigation
    	this.navigate = null;
    ...
    et l'appel de la méthode devient donc :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    var test = new mBox(document.getElementById('titi'),'très belle soirée',true);
    en tous cas merci a toi pour tout ces test

    d'une j'aurais avancé , testé en cas réelle et je te fournis la version finale en préview très très vite

  20. #40
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2006
    Messages : 72
    Par défaut
    Merci tu es un chef !!!

    Tout fonctionne !!!

    Si jamais je l'ai mis en ligne, donc l'adresse devient :
    http://www.jeunesse-satigny.ch/galer...on=photos&id=5

    Merci encore pour tout, je met "Résolu"


+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 3 PremièrePremière 123 DernièreDernière

Discussions similaires

  1. [iframe]pb de chargement d'une page
    Par Destampy dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 26/05/2005, 11h19
  2. Chargement d'une page
    Par krfa1 dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 13/05/2005, 09h53
  3. [JSP] pbl chargement d'une page JSP
    Par Shiryu44 dans le forum Servlets/JSP
    Réponses: 4
    Dernier message: 30/03/2005, 10h49
  4. Réponses: 4
    Dernier message: 08/06/2004, 09h01
  5. Attendre la fin du chargement de la page dans un WebBrowser
    Par core1 dans le forum Web & réseau
    Réponses: 5
    Dernier message: 15/06/2003, 04h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo