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 :

Script JS semble ne pas fonctionner sur safari mais fonctionne sur les autres navigateurs


Sujet :

JavaScript

  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Octobre 2014
    Messages : 25
    Points : 10
    Points
    10
    Par défaut Script JS semble ne pas fonctionner sur safari mais fonctionne sur les autres navigateurs
    Bonjour,

    pour un site internet que je suis en train de développer, j'ai récupéré et adapté un script js qui me permet d'avoir un carousel d'images.
    Ce carousel à une version pour les grands affichages, version dans laquelle deux images sont juxtaposées pour une même slide.
    La version pour les affichages de taille réduite ne comporte plus qu'une seule image par slide.

    Pour ce faire j'ai opté pour la solution de créer deux carousels différents, appelés par des media queries.
    Ce n'est peut-être pas la meilleure solution mais pour le moment cela fonctionne.
    J'ai testé sur chrome, opera, firefox et safari.

    Sur les trois premiers navigateurs cela fonctionne, lorsque je clique sur ma flèche pour aller à l'image suivante l'action fonctionne, idem lorsque je clique sur la flèche pour revenir à l'image précédente.
    En revanche sur Safari je ne peux pas cliquer sur les flèches, cela ne fonctionne pas.
    J'ai essayé de trouver des réponses ailleurs mais mes connaissances en js sont très limitées. Alors merci d'avance pour votre aide
    Je ne sais pas s'il est nécessaire que je joigne ici mes codes html et css, je commence donc seulement par le JS.

    Voici mon script js

    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
    //SLIDER POUR IMAGES
     
    if (window.matchMedia("(max-width: 960px)").matches) {
        // do stuff when your screen width is lower than 960px
     
    const prev = document.querySelector('.smallnext');
    const next = document.querySelector('.smallprev');
    const images = document.querySelector('.carouselsmall').children;
    const totalImages = images.length;
    let index = 0;
     
    prev.addEventListener('click', () => {
      nextImage('smallnext');
    })
     
    next.addEventListener('click', () => {
      nextImage('smallprev');
    })
     
    function nextImage(direction) {
      if(direction == 'smallnext') {
        index++;
        if(index == totalImages) {
          index = 0;
        }
      } else {
        if(index == 0) {
          index = totalImages - 1;
        } else {
          index--;
        }
      }
     
      for(let i = 0; i < images.length; i++) {
        images[i].classList.remove('main');
      }
      images[index].classList.add('main');
    }
     
     
       } else {
        // do stuff when your screen width is greater than 960px
     
     
    const prev = document.querySelector('.next');
    const next = document.querySelector('.prev');
    const images = document.querySelector('.carousel').children;
    const totalImages = images.length;
    let index = 0;
     
    prev.addEventListener('click', () => {
      nextImage('next');
    })
     
    next.addEventListener('click', () => {
      nextImage('prev');
    })
     
    function nextImage(direction) {
      if(direction =='next') {
        index++;
        if(index == totalImages) {
          index = 0;
        }
      } else {
        if(index == 0) {
          index = totalImages - 1;
        } else {
          index--;
        }
      }
     
      for(let i = 0; i < images.length; i++) {
        images[i].classList.remove('main');
      }
      images[index].classList.add('main');
    }
       }

  2. #2
    Membre averti Avatar de ASCIIDEFOND
    Homme Profil pro
    Autodidacte passionné
    Inscrit en
    Novembre 2002
    Messages
    235
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Landes (Aquitaine)

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 235
    Points : 441
    Points
    441
    Par défaut
    Salut hadidi,

    Avec une constante, l'identifiant ne peut être réaffecté.

    Code JavaScript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    ...
    const prev = document.querySelector('.smallnext');
    const next = document.querySelector('.smallprev');
    const images = document.querySelector('.carouselsmall').children;
    ...
    const prev = document.querySelector('.next');
    const next = document.querySelector('.prev');
    const images = document.querySelector('.carousel').children;
    ...

    https://developer.mozilla.org/fr/doc...atements/const

  3. #3
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Octobre 2014
    Messages : 25
    Points : 10
    Points
    10
    Par défaut
    Citation Envoyé par ASCIIDEFOND Voir le message
    ...Avec une constante, l'identifiant ne peut être réaffecté.
    Merci,

    J'avoue que j'ai très très peu de connaissance en js... Je ne comprends donc pas très bien l'article dont tu as envoyé le lien.
    Le problème dans mon script est la syntaxe ? Il faudrait que je change la constante par autre chose ?
    Aussi, pourquoi cela fonctionne sur tous les navigateurs sauf safari ?

  4. #4
    Membre averti Avatar de ASCIIDEFOND
    Homme Profil pro
    Autodidacte passionné
    Inscrit en
    Novembre 2002
    Messages
    235
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Landes (Aquitaine)

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 235
    Points : 441
    Points
    441
    Par défaut
    Remplacer les déclarations const avec var pour que les valeurs soient variables et non plus constantes.

    Code JavaScript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    ...
    var prev = document.querySelector('.smallnext');
    var next = document.querySelector('.smallprev');
    var images = document.querySelector('.carouselsmall').children;
    ...
    var prev = document.querySelector('.next');
    var next = document.querySelector('.prev');
    var images = document.querySelector('.carousel').children;
    ...

    Si tu avais la partie HTML du code à nous présenter pour pouvoir le tester.

  5. #5
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Octobre 2014
    Messages : 25
    Points : 10
    Points
    10
    Par défaut
    Citation Envoyé par ASCIIDEFOND Voir le message
    Remplacer les déclarations const avec var .....

    Voici la partie du
    Code html : 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
    <!DOCTYPE html>
    <html>
    <head>
     
      	<title>Duo Impair</title>
        <link rel="icon" type="image/x-icon" href="images/favimpair.png">
     	  <meta charset="UTF-8" />
        <meta name="Author" content="Duo Impair">
        <meta name="Description" content="Duo Impair, french graphic design studio.">
        <meta name="Keywords" content="Graphic Design, Art Direction, Typography, Research, Photography">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
     
        <!--<link rel='stylesheet' id='fonts-css'  href='fonts/font.css' type='text/css' media='all' />-->
        <link rel='stylesheet' id='style-css'  href='styles/style.css' type='text/css' media='all' />
     
    </head>
     
     
    <body>
     
     
    	<!--------------------------------------------- Haut de Page --------------------------------------------->
     
    	<header role="header">
     
     
    		<nav class="menu" role="sections">
     
                    <div class="inner">
     
                <div class="m-left">
                     <h1 class="logo">DUO IMPAIR &emsp; Graphic Design Studio</h1>
                </div>
     
                <div class="m-right">
                    <a href="index.html" class="m-link" style="color: blue">Projects</a>
                    <a href="info.html" class="m-link">About</a>
                </div>
     
                    </div>            
     
    	</header>
     
     
        <!--------------------------------------------- Images et légendes --------------------------------------------->
     
     
                <div class="carousel-container">
     
                        <!--<div class="prev nav-btn">←</div>-->
                        <div class="prev nav-btn"><img src="images/arrowdotl.png"/></div>
     
                    <div class="carousel">
     
                        <div class="item main">
                <img src="images/HutteSite1.jpg"/>
                <img src="images/HutteSite2.jpg"/>
     
                <div class="caption">
                <ul class="cap">
                    <li>Hutte Mono (Regular & Swash), Type Design, 2023.</li>
                    <li>The font design was inspired by the regular shapes defined by mono typefaces together with rounded terminals. Hutte is taking a step aside from the common monospace fonts with the Swash version that plays with the spacing, the ornaments and the flourishing aspects of the letters.</li>
                </ul>
                            </div>
                        </div>
     
     
                        <div class="item">
                <img src="images/Bushel1.jpg"/>
                <img src="images/Bushel2.jpg"/>
     
                <div class="caption">
                <ul class="cap">
                    <li>Bushels of Goodness and Warmth, Graphic design, Layout, 2022 [with Jordan Derrien and V.O Curations Gallery (London)]</li>
                    <li>Catalogue of the exhibition: Bushels of goodness by the artist Jordan Derrien. With a text written by Marie de Brugerolle and photographies taken by Theo Christelis.</li>
                </ul>
                            </div>
                        </div>
     
                        <div class="item">
                <img src="images/SupaVenezia1.jpg"/>
                <img src="images/SupaVenezia2.jpg"/>
     
                            <div class="caption">
                <ul class="cap">
                    <li>SupaVenezia Cap, Identity, Graphic Design, 2022 [with the artist Sarah Staton]</li>
                    <li>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</li>
                </ul>
                            </div>
                        </div>
     
                    </div>
     
                    <!--<div class="next nav-btn ">→</div>-->
                    <div class="next nav-btn "><img src="images/arrowdotr.png"/></div>
     
    <!--<script type="text/javascript" src="scripts/app.js"></script>-->
     
     
                    </div> 
     
     
     
     
    <!--------------------------------------------- Images et légendes small devices  --------------------------------------------->
     
     
    <div class="carousel-containersmall">
     
                        <div class="smallprev smallnav-btn"><img src="images/arrowdotl.png"/></div>
     
                    <div class="carouselsmall">
     
                        <div class="item main">
                <img src="images/HutteSite1.jpg"/>
     
                <div class="captionsmall">
                <ul class="capsmall">
                    <li>Hutte Mono (Regular & Swash), Type Design, 2023.</li>
                    <li>The font design was inspired by the regular shapes defined by mono typefaces together with rounded terminals. Hutte is taking a step aside from the common monospace fonts with the Swash version that plays with the spacing, the ornaments and the flourishing aspects of the letters.</li>
                </ul>
                            </div>
                        </div>
     
                         <div class="item">
                <img src="images/HutteSite2.jpg"/>
     
                <div class="captionsmall">
                <ul class="capsmall">
                    <li>Hutte Mono (Regular & Swash), Type Design, 2023.</li>
                    <li>The font design was inspired by the regular shapes defined by mono typefaces together with rounded terminals. Hutte is taking a step aside from the common monospace fonts with the Swash version that plays with the spacing, the ornaments and the flourishing aspects of the letters.</li>
                </ul>
                            </div>
                        </div>
     
     
                        <div class="item">
                <img src="images/Bushel1.jpg"/>
     
                <div class="captionsmall">
                <ul class="capsmall">
                    <li>Bushels of Goodness and Warmth, Graphic design, Layout, 2022 [with Jordan Derrien and V.O Curations Gallery (London)]</li>
                    <li>Catalogue of the exhibition: Bushels of goodness by the artist Jordan Derrien. With a text written by Marie de Brugerolle and photographies taken by Theo Christelis.</li>
                </ul>
                            </div>
                        </div>
     
                        <div class="item">
                <img src="images/Bushel2.jpg"/>
     
                <div class="captionsmall">
                <ul class="capsmall">
                    <li>Bushels of Goodness and Warmth, Graphic design, Layout, 2022 [with Jordan Derrien and V.O Curations Gallery (London)]</li>
                    <li>Catalogue of the exhibition: Bushels of goodness by the artist Jordan Derrien. With a text written by Marie de Brugerolle and photographies taken by Theo Christelis.</li>
                </ul>
                            </div>
                        </div>
     
                        <div class="item">
                <img src="images/SupaVenezia1.jpg"/>
     
                            <div class="captionsmall">
                <ul class="capsmall">
                    <li>SupaVenezia Cap, Identity, Graphic Design, 2022 [with the artist Sarah Staton]</li>
                    <li>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</li>
                </ul>
                            </div>
                        </div>
     
                        <div class="item">
                <img src="images/SupaVenezia2.jpg"/>
     
                <div class="captionsmall">
                <ul class="capsmall">
                    <li>SupaVenezia Cap, Identity, Graphic Design, 2022 [with the artist Sarah Staton]</li>
                    <li>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</li>
                </ul>
                            </div>
                        </div>
     
                    </div>
     
                    <!--<div class="next nav-btn ">→</div>-->
                    <div class="smallnext smallnav-btn "><img src="images/arrowdotr.png"/></div>
     
    <!--<script type="text/javascript" src="scripts/app.js"></script>-->
     
                    </div>
     
     
        <!--------------------------------------------- Pied de Page --------------------------------------------->
     
    <script type="text/javascript" src="scripts/app.js"></script>
    </body>
    </html>

  6. #6
    Membre averti Avatar de ASCIIDEFOND
    Homme Profil pro
    Autodidacte passionné
    Inscrit en
    Novembre 2002
    Messages
    235
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Landes (Aquitaine)

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 235
    Points : 441
    Points
    441
    Par défaut
    Insérer la même fonction (function nextImage(direction)) dans deux instructions if, cela ne me semble pas très conventionnel.

    Peux-tu nous donner le code CSS, parce que là je patauge un peu.

  7. #7
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Octobre 2014
    Messages : 25
    Points : 10
    Points
    10
    Par défaut
    Voici le
    Code CSS : 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
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    /* APPEL DE LA POLICE DE CARACTERES */
     
    @font-face {
        font-family: "maintype";
        src: url("../types/HuttemonoV1-Regular.otf");
        }
     
     
    /* VALEURS BODY DEFINIES POUR TOUT LE DOCUMENT */
     
    html, body {
        font-family: "maintype", sans-serif;
        width: 100%;
        height: 100%;
        border: 0 none;
        margin: 0;
        padding: 0;
        vertical-align: baseline;
        overflow-y: hidden;
        }
     
    @media all and (min-width: 960px){
     
    /* HEADER NOM DU STUDIO ET ONGLETS DE SECTIONS DU SITE INTERNET */
     
     
    .menu{
        width: 100%;
        }
     
    .inner {
        width: 100%;
        }
     
     
    .m-left{
        float: left;
        }
     
     
    .logo{
        margin: 0;
        padding-left: 15px;
        padding-right: 15px;
        font-family: "maintype";
        font-weight: normal;
        font-size: 20px;
        }
     
     
    .m-right{
        float: right;
        }
     
    .m-link{
        text-decoration: none;
        color: black;
        text-transform: uppercase;
        font-weight: normal;
        font-size: 20px;
        margin:0;
        padding-left: 15px;
        padding-right: 15px;
        }
     
    .m-link:hover {
        color: blue;
        }
     
     
    /* CARROUSEL ET FLECHES DE NAVIGATIONS PREV/NEXT */
     
     
    .carousel-container {
        display: flex;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 96%;
        }
    .carousel-containersmall {
        display: none;
        }
     
    .carousel {
      display: inline-block;
      text-align: center;
      padding: 0;
      width: 80%;
      height: 100%;
      transition: all 0.3s ease;
      /*background-color: blue;*/
        }
     
     
    .next {
        z-index: 10;
        margin: auto;
        width: 10%;
        height: 10%;
        }
     
    .prev {
        z-index: 10;
        margin: auto;
        width: 10%;
        height: 10%;
        }
     
    .nav-btn {
        display: flex;
        justify-content: space-around;
        cursor: pointer;
        -webkit-user-select: none;
        color: blue;
        margin-top: 20%;
        }
     
    .item {
        display: none;
        }
     
    .main {
        display: inline-block;
        }
     
     .carousel img {
      display: inline-block;
      position: relative;
      padding: 10px 30px 20px 30px;
      margin: auto;
      max-width: 35%;
      transition: all 0.3s ease;
        }
     
     
    .caption {
        position: relative;
        margin: auto;
        font-size: 13px;
        line-height: 1.2em;
        }
     
    .cap {
        column-count: 2;
        padding: 0 20px 0 20px;
        text-align: left;
        list-style: none;
        /*background-color: gold;*/
        }
     
     
    }
     
     
    /* --------------------------- RESPONSIVE POUR LARGEUR MAX 960px -------------------------------------- */
     
     
     
    @media all and (max-width: 960px){
     
     
    /* HEADER NOM DU STUDIO ET ONGLETS DE SECTIONS DU SITE INTERNET */
     
     
    .inner {
        width: 100%;
        }
     
     
    .menu{
     
        width: 100%;
        }
     
    .m-left{
        float: left;
        }
     
     
    .logo{
     
        margin: 0;
        padding-left: 15px;
        font-family: "maintype";
        font-weight: normal;
        font-size: 20px;
        }
     
     
     
    .m-right{
        float: right;
        }
     
    .m-link{
        text-decoration: none;
        color: black;
        text-transform: uppercase;
        font-weight: normal;
        font-size: 20px;
        margin: 0;
        padding-left: 15px;
        padding-right: 15px;
        }
     
    .m-link:hover {
        color: blue;
        }
     
        /* CARROUSEL ET FLECHES DE NAVIGATIONS PREV/NEXT */
     
     
    .carousel-container {
        display: none;
        /*margin: 0;
        padding: 0;
        width: 100%;
        height: 96%;*/
        }
     
    .carousel-containersmall {
        display: flex;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 96%;
     
        }
     
    .carousel {
      display: none;
      /*text-align: center;
      padding: 0;
      width: 80%;
      height: 100%;
      transition: all 0.3s ease;*/
        }
     
        .carouselsmall {
      display: block;
      text-align: center;
      padding: 0;
      width: 80%;
      height: 100%;
      transition: all 0.3s ease;
        }
     
    .next {
        /*z-index: 10;
        margin: auto;
        width: 10%;
        height: 10%;*/
        display: none;
        }
     
    .smallnext {
        z-index: 10;
        margin: auto;
        width: 10%;
        height: 10%;
        }
     
     
    .prev {
        /*z-index: 10;
        margin: auto;
        width: 10%;
        height: 10%;*/
        display: none;
        }
     
        .smallprev {
        z-index: 10;
        margin: auto;
        width: 10%;
        height: 10%;
        }
     
     
    .nav-btn {
        /*display: flex;
        justify-content: space-around;
        cursor: pointer;
        -webkit-user-select: none;
        color: blue;
        margin-top: 20%;*/
        display: none;
        }
     
        .smallnav-btn {
        display: flex;
        justify-content: space-around;
        cursor: pointer;
        -webkit-user-select: none;
        color: blue;
        margin-top: 30%;
        }
     
    .item {
        display: none;
        }
     
    .main {
        display: block;
        }
     
     
     .carousel img {
      /*display: block;
      position: absolute;
      padding: 10px 30px 20px 30px;
      margin-left: 13%;
      max-width: 45%;
      transition: all 0.3s ease;*/
      display: none;
        }
     
     
     .carouselsmall img {
      display: block;
      position: absolute;
      padding: 10px 30px 20px 30px;
      margin-left: 13%;
      max-width: 45%;
      transition: all 0.3s ease;
        }
     
     
    .caption {
        display: none;
        }
     
    .captionsmall {
        position: absolute;
        display: block;
        margin-top: 70%;
        font-size: 12px;
        line-height: 1.1em;
        width: 65%;
        left:48%;
        transform: translate(-48%);
        }
     
    .cap {
        display: none;
        }
     
    .capsmall {
        column-count: 1;
        list-style: none;
        text-align: left;
        padding: 0;
        }
     
    }
     
     
    /* --------------------------- RESPONSIVE POUR LARGEUR MAX 720px --------------------------- */
     
     
     
    @media all and (max-width: 720px){
     
     
    /* HEADER NOM DU STUDIO ET ONGLETS DE SECTIONS DU SITE INTERNET */
     
     
    .inner {
        width: 100%;
        }
     
     
    .menu{
     
        width: 100%;
        }
     
    .m-left{
        float: left;
        }
     
     
    .logo{
     
        margin: 0;
        padding-left: 15px;
        font-family: "maintype";
        font-weight: normal;
        font-size: 15px;
        }
     
     
     
    .m-right{
        display: block;
        float: right;
        }
     
    .m-link{
        text-decoration: none;
        color: black;
        text-transform: uppercase;
        font-weight: normal;
        font-size: 15px;
        margin: 0;
        padding-left: 15px;
        padding-right: 15px;
        }
     
    .m-link:hover {
        color: blue;
        }
     
     
        /* CARROUSEL ET FLECHES DE NAVIGATIONS PREV/NEXT */
     
     
    .carousel-container {
        /*display: flex;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 96%;*/
        display: none;
        }
     
    .carousel-containersmall {
        display: flex;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 96%;
            }
     
    .carousel {
      /*display: block;
      text-align: center;
      padding: 0;
      width: 80%;
      height: 100%;
      transition: all 0.3s ease;*/
      display: none;
          }
     
    .carouselsmall {
      display: block;
      text-align: center;
      padding: 0;
      width: 80%;
      height: 100%;
      transition: all 0.3s ease;    
            }
     
    .next {
        /*z-index: 30;
        margin: auto;
        width: 10%;
        height: 10%;*/
        display: none;
        }
     
    .smallnext {
        z-index: 30;
        margin: auto;
        width: 10%;
        height: 10%;
    }
     
    .prev {
        /*z-index: 30;
        margin: auto;
        width: 10%;
        height: 10%;*/
        display: none;
        }
     
    .smallprev {
        z-index: 30;
        margin: auto;
        width: 10%;
        height: 10%;
    }
     
    .nav-btn {
        /*display: flex;
        justify-content: space-around;
        cursor: pointer;
        -webkit-user-select: none;
        color: blue;
        margin-top: 20%;*/
        display: none;
        }
     
    .smallnav-btn {
        display: flex;
        justify-content: space-around;
        cursor: pointer;
        -webkit-user-select: none;
        color: blue;
        margin-top: 40%;
    }
     
    .item {
        display: none;
        }
     
    .main {
        display: block;
        }
     
     .carousel img {
      /*display: block;
      position: absolute;
      padding: 10px 30px 20px 30px;
      margin-left: 4%;
      max-width: 60%;
      transition: all 0.3s ease;*/
      display: none;
        }
     
    .carouselsmall img {
        display: block;
        position: absolute;
        padding: 10px 30px 20px 30px;
        margin-left: 4%;
        max-width: 60%;
        transition: all 0.3s ease;
    }
     
    .caption {
        /*position: absolute;
        display: block;
        margin-top: 95%;
        font-size: 12px;
        line-height: 1.1em;
        width: 80%;
        left:50%;
        transform: translate(-50%);*/
        display: none;
        }
     
    .captionsmall {
        position: absolute;
        display: block;
        margin-top: 93%;
        font-size: 12px;
        line-height: 1.1em;
        width: 85%;
        left:50%;
        transform: translate(-50%);
    }
     
    .cap {
        /*column-count: 1;
        list-style: none;
        text-align: left;
        padding: 0;*/
        display: none;
        }
     
    .capsmall {
        column-count: 1;
        list-style: none;
        text-align: left;
        padding: 0;
    }
     
     
    }
     
     
    /* --------------------------- RESPONSIVE POUR LARGEUR MAX 520px --------------------------- */
     
     
     
    @media all and (max-width: 520px){
     
     
    /* HEADER NOM DU STUDIO ET ONGLETS DE SECTIONS DU SITE INTERNET */
     
     
    .inner {
        width: 100%;
        }
     
     
    .menu{
     
        width: 100%;
        }
     
    .m-left{
        float: left;
        }
     
     
    .logo{
     
        margin: 0;
        padding-left: 15px;
        font-family: "maintype";
        font-weight: normal;
        font-size: 15px;
        }
     
     
     
    .m-right{
        display: block;
        float: left;
        }
     
    .m-link{
        text-decoration: none;
        color: black;
        text-transform: uppercase;
        font-weight: normal;
        font-size: 15px;
        margin: 0;
        padding-left: 15px;
        padding-right: 15px;
        }
     
    .m-link:hover {
        color: blue;
    }
     
    }

  8. #8
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 110
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 110
    Points : 44 908
    Points
    44 908
    Par défaut
    Bonjour,
    Pour ce faire j'ai opté pour la solution de créer deux carousels différents, appelés par des media queries.
    Ce n'est peut-être pas la meilleure solution mais pour le moment cela fonctionne.
    je confirme, il y a de la factorisation dans l'air.


    En revanche sur Safari je ne peux pas cliquer sur les flèches, cela ne fonctionne pas.
    Quel OS et version pour Safari ?

  9. #9
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Octobre 2014
    Messages : 25
    Points : 10
    Points
    10
    Par défaut
    Bonjour,

    je suis sur Mac Os 13.5.1, et la version de safari est la version 16.6
    Que voulez-vous dire par il y a de la factorisation dans l'air ?

    Merci

  10. #10
    Membre averti Avatar de ASCIIDEFOND
    Homme Profil pro
    Autodidacte passionné
    Inscrit en
    Novembre 2002
    Messages
    235
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Landes (Aquitaine)

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 235
    Points : 441
    Points
    441
    Par défaut
    J’ai modifié à 90% ton code, car ce dernier était un peu une usine à gaz.

    Code HTML : 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
    <!DOCTYPE html>
    <html>
     
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <style>
            * {
                box-sizing: border-box;
            }
     
            .column {
                height: auto;
                float: left;
                padding: 20px;
                /* border: 1px solid black; */
                width: 49%;
            }
     
            .column:nth-child(1) {
                float: inline-start;
                margin: 0 auto 15px auto;
            }
     
            .column:nth-child(2) {
                float: inline-end;
                margin: auto;
            }
     
            .row {
                position: absolute;
                top: 110px;
                left: 3%;
                right: 3%;
                padding-bottom: 55px;
            }
     
            .row:after {
                content: "";
                display: table;
                clear: both;
            }
     
            @media screen and (max-width: 960px) {
                .column {
                    width: 100%;
                }
     
                img {
                    width: 100%;
                    height: auto;
                    object-fit: cover;
                    object-position: center;
                }
            }
     
            @media screen and (max-width: 600px) {
                .column {
                    width: 100%;
                }
     
                img {
                    width: 100%;
                    height: auto;
                    object-fit: cover;
                    object-position: center;
                }
            }
     
            .footer {
                position: fixed;
                left: 0;
                bottom: 0;
                width: 100%;
                text-align: center;
            }
     
            .arrow {
                position: absolute;
                cursor: pointer;
                color: #ffffff;
                border: 1px solid #ffffff00;
                font-weight: bold;
                font-size: 1.8em;
                transition: 0.2s ease;
                border-radius: .5em;
                user-select: none;
                background-color: rgba(0, 0, 0, 0.12);
                opacity: 0.7;
                padding: 0 5% 0 5%;
                margin: 0 30% 0 30%;
                bottom: 7px;
            }
     
            .arrow:active {
                background-color: rgba(255, 246, 246, 0.345);
                color: #070707;
                border: 1px solid #1a1919;
            }
     
            .arrow:hover {
                background-color: rgba(0, 0, 0, 0.143);
                opacity: 1;
            }
     
            .prev {
                left: 5px;
            }
     
            .next {
                right: 5px;
            }
     
            .prev::before {
                content: "\0023F4";
            }
     
            .next::before {
                content: "\0023F5";
            }
        </style>
    </head>
     
    <body>
        <header role="header">
            <nav class="menu" role="sections">
                <div>
                    <div>
                        <h1 class="logo">DUO IMPAIR &emsp; Graphic Design Studio</h1>
                    </div>
                    <div>
                        <a href="index.html" style="color: blue">Projects</a>
                        <a href="info.html">About</a>
                    </div>
                </div>
        </header>
     
        <div class="row">
            <div class="column">
                <img class="carrousel" src="https://i.imgur.com/P9IVqkS.webp" width="400" height="auto" />
                <div></div>
            </div>
            <div class="column">
                <img class="carrousel" src="https://i.imgur.com/gqBG7EK.webp" width="400" height="auto" />
                <div></div>
            </div>
        </div>
     
        <div class="footer">
            <a class="prev arrow"></a>
            <a class="next arrow"></a>
        </div>
     
        <script>
            const slides = [
                { nameimg: "3rCW1xj.webp", info: "<p><b>Bushels of Goodness and Warmth, Graphic design, Layout, 2022 [with Jordan Derrien and V.O Curations Gallery (London)]</b><br/>Catalogue of the exhibition: Bushels of goodness by the artist Jordan Derrien. With a text written by Marie de Brugerolle and photographies taken by Theo Christelis.</p>" },
                { nameimg: "AsXzjqX.webp", info: "<p><b>SupaVenezia Cap, Identity, Graphic Design, 2022 [with the artist Sarah Staton]</b><br/>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</p>" },
                { nameimg: "aJndu7X.webp", info: "<p><b>Hutte Mono (Regular & Swash), Type Design, 2023.</b><br/>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</p>" },
                { nameimg: "gVx56OF.webp", info: "<p><b>Bushels of Goodness and Warmth, Graphic design, Layout, 2022 [with Jordan Derrien and V.O Curations Gallery (London)]</b><br/>Catalogue of the exhibition: Bushels of goodness by the artist Jordan Derrien. With a text written by Marie de Brugerolle and photographies taken by Theo Christelis.</p>" },
                { nameimg: "gqBG7EK.webp", info: "<p><b>SupaVenezia Cap, Identity, Graphic Design, 2022 [with the artist Sarah Staton]</b><br/>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</p>" },
                { nameimg: "P9IVqkS.webp", info: "<p><b>Hutte Mono (Regular & Swash), Type Design, 2023.</b><br/>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</p>" }
            ]
     
            let arrows = document.querySelectorAll('.arrow'),
                imgA = document.getElementsByClassName("carrousel")[0],
                imgB = document.getElementsByClassName("carrousel")[1],
                i = 0
     
            function actualisation() {
                imgA.src = `https://i.imgur.com/${slides[i].nameimg}`
                imgB.src = `https://i.imgur.com/${slides[i + 1].nameimg}`
                imgA.nextElementSibling.innerHTML = slides[i].info
                imgB.nextElementSibling.innerHTML = slides[i + 1].info
            }
     
            for (const arrowSelect of arrows) {
                arrowSelect.addEventListener("click", () => {
                    // ici une condition if else ('?' -> 'alors' et ':' -> 'sinon')
                    arrowSelect.classList.contains('prev') == true ? slides[i - 2] ? i -= 2 : i = slides.length - 2 : slides[i + 2] ? i += 2 : i = 0
                    actualisation()
                })
            }
     
            actualisation()
        </script
    </body>
    </html>

    Il est un peu plus compact et lisible que l’ancien. Si cela te convient ?

  11. #11
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Octobre 2014
    Messages : 25
    Points : 10
    Points
    10
    Par défaut
    Bravo et merci,
    cela fonctionne magnifiquement bien.
    Ce code dépasse un peu mes connaissances limitées, pourrais-tu m'en donner quelques explications ?
    Notamment sur la manière donc je peux changer les images (qui proviendraient d'un dossier sur mon ordi)?
    Enfin, lorsque la fenêtre du navigateur se réduit, avec ton code nous passons d'un "dyptique horizontal" à un "dyptique vertical".
    Comment faire pour n'avoir qu'une seule image?

    Merci encore en tout cas

  12. #12
    Membre averti Avatar de ASCIIDEFOND
    Homme Profil pro
    Autodidacte passionné
    Inscrit en
    Novembre 2002
    Messages
    235
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Landes (Aquitaine)

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 235
    Points : 441
    Points
    441
    Par défaut
    Citation Envoyé par hadidi Voir le message
    ... pourrais-tu m'en donner quelques explications ?
    Notamment sur la manière donc je peux changer les images (qui proviendraient d'un dossier sur mon ordi)?...
    Pour le tabeau slides
    ex. {nameimg:"Ici le nom et l'extension du fichier", info:"<p>Une balise p (obligatoire)<b>Une balise b pour un mot ou texte en gras (optionnel)</b>La suite de ton texte qui accompagne l'image et tu ferme la balise p.</p>"}, etc..

    Code JavaScript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    const slides = [
                { nameimg: "3rCW1xj.webp", info: "<p><b>Bushels of Goodness and Warmth, Graphic design, Layout, 2022 [with Jordan Derrien and V.O Curations Gallery (London)]</b><br/>Catalogue of the exhibition: Bushels of goodness by the artist Jordan Derrien. With a text written by Marie de Brugerolle and photographies taken by Theo Christelis.</p>" },
                { nameimg: "AsXzjqX.webp", info: "<p><b>SupaVenezia Cap, Identity, Graphic Design, 2022 [with the artist Sarah Staton]</b><br/>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</p>" },
    ...
            ]

    Dans la fonction actualisation

    imgA.src = `https://i.imgur.com/${slides[i].nameimg}`

    "https://i.imgur.com/" est l'adresse ou se trouve les fichiers images. Tu la remplace par le chemin de tes images. ex. "images/"

    ${slides[i].nameimg}

    slides est le nom du tableau plus haut et le [i] est l'index du tableau.
    ex. slides[1].nameimg recupère la valeur du deuxième nameing -> "AsXzjqX.webp", et pour slides[1].info -> "<p><b>SupaVenezia Cap, Identity, Graphic Design, 2022 [with the artist Sarah Staton]</b><br/>..."

    Attention ne pas confondre une simples quotes ' avec l'accent grave ` (ALTGR + è) pour `${expression}`

    Citation Envoyé par hadidi Voir le message
    ...lorsque la fenêtre du navigateur se réduit, avec ton code nous passons d'un "dyptique horizontal" à un "dyptique vertical".
    Comment faire pour n'avoir qu'une seule image?...
    Bonne question. mais le problème est que les images s'affichent par deux. Il faut peut-être modifier le code CSS via le JavaScript lorsque la fenêtre se réduit ?

    Sinon le code fonctionne sur Safari ?

  13. #13
    Membre averti Avatar de ASCIIDEFOND
    Homme Profil pro
    Autodidacte passionné
    Inscrit en
    Novembre 2002
    Messages
    235
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Landes (Aquitaine)

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 235
    Points : 441
    Points
    441
    Par défaut
    Citation Envoyé par hadidi Voir le message
    ...
    Enfin, lorsque la fenêtre du navigateur se réduit, avec ton code nous passons d'un "dyptique horizontal" à un "dyptique vertical".
    Comment faire pour n'avoir qu'une seule image?...
    J'ai une solution qui fonctionne apparemment pas trop mal.
    Remplacer l'ancien script par celui-ci.

    Code JavaScript : 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
        <script>
            const slides = [
                { nameimg: "3rCW1xj.webp", info: "<p><b>0 Bushels of Goodness and Warmth, Graphic design, Layout, 2022 [with Jordan Derrien and V.O Curations Gallery (London)]</b><br/>Catalogue of the exhibition: Bushels of goodness by the artist Jordan Derrien. With a text written by Marie de Brugerolle and photographies taken by Theo Christelis.</p>" },
                { nameimg: "AsXzjqX.webp", info: "<p><b>1 SupaVenezia Cap, Identity, Graphic Design, 2022 [with the artist Sarah Staton]</b><br/>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</p>" },
                { nameimg: "aJndu7X.webp", info: "<p><b>2 Hutte Mono (Regular & Swash), Type Design, 2023.</b><br/>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</p>" },
                { nameimg: "gVx56OF.webp", info: "<p><b>3 Bushels of Goodness and Warmth, Graphic design, Layout, 2022 [with Jordan Derrien and V.O Curations Gallery (London)]</b><br/>Catalogue of the exhibition: Bushels of goodness by the artist Jordan Derrien. With a text written by Marie de Brugerolle and photographies taken by Theo Christelis.</p>" },
                { nameimg: "gqBG7EK.webp", info: "<p><b>4 SupaVenezia Cap, Identity, Graphic Design, 2022 [with the artist Sarah Staton]</b><br/>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</p>" },
                { nameimg: "P9IVqkS.webp", info: "<p><b>5 Hutte Mono (Regular & Swash), Type Design, 2023.</b><br/>SupaVenezia is part of SupaStore the event based durational artwork of the artist Sarah Staton, an ongoing series of stores as exhibitions established in 1993. We used the Brizeux font designed by Roman Seban and Véfa Lucas.</p>" }
            ]
     
            let arrows = document.querySelectorAll('.arrow'),
                imgA = document.getElementsByClassName("carrousel")[0],
                imgB = document.getElementsByClassName("carrousel")[1],
                i = 0
     
            function actualisation() {
                imgA.src = `https://i.imgur.com/${slides[i].nameimg}`
                imgA.nextElementSibling.innerHTML = slides[i].info
     
                if (!window.matchMedia("(max-width: 960px)").matches) {              
                    if (i + 1 >= slides.length) i -= 1
                    imgB.parentElement.style.display = "block"
                    imgB.src = `https://i.imgur.com/${slides[i + 1].nameimg}`
                    imgB.nextElementSibling.innerHTML = slides[i + 1].info
                } else {
                    imgB.parentElement.style.display = "none"
                }
            }
     
            for (const arrowSelect of arrows) {
                arrowSelect.addEventListener("click", () => {
                    let ii
                    // ici une condition if else ('?' -> 'alors' et ':' -> 'sinon')
                    // Si matches -> ii = 1 sinon ii = 2
                    window.matchMedia("(max-width: 960px)").matches ? ii = 1 : ii = 2
                    arrowSelect.classList.contains('prev') == true ? slides[i - ii] ? i -= ii : i = slides.length - ii : slides[i + ii] ? i += ii : i = 0
     
                    actualisation()
                })
            }
     
            window.onresize = actualisation;
     
            actualisation()
        </script>

  14. #14
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Octobre 2014
    Messages : 25
    Points : 10
    Points
    10
    Par défaut
    Merci Beaucoup pour tes explications et tes modifications.
    Cela fonctionne en effet très bine sur Safari.
    Je vais donc maintenant essayer d'adapter ton code à la "mise en page" que je souhaite avoir.

    Encore merci pour ton temps et ton aide.

    [Modération] Suite de la discussion pour un autre problème : https://www.developpez.net/forums/d2...-prise-compte/

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Applet s'exécute sur Internet Explorer mais pas sur les autres navigateurs
    Par rosert dans le forum Développement Web en Java
    Réponses: 3
    Dernier message: 13/02/2015, 13h14
  2. Réponses: 8
    Dernier message: 30/08/2011, 16h17
  3. Réponses: 9
    Dernier message: 31/05/2011, 10h27
  4. [firePropertyChange] semble ne pas fonctionner ?
    Par jcodeunpeu dans le forum AWT/Swing
    Réponses: 11
    Dernier message: 19/12/2005, 14h37

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