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

Mise en page CSS Discussion :

Besoin d'aide pour améliorer un code zoom sur image


Sujet :

CSS

  1. #1
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Novembre 2016
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Saône (Franche Comté)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Novembre 2016
    Messages : 7
    Points : 2
    Points
    2
    Par défaut Besoin d'aide pour améliorer un code zoom sur image
    Bonjour,
    Je cherche à améliorer un code qui permet de zoomer sur une image dans une galerie avec un lien vers le site correspondant. ça marche mais mon problème, c'est que je souhaite qu'au zoom les autres images restent fixent en arrière plan. Je bute là-dessus.
    Voici le code :
    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
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    <head>
    <style type="text/css">
     
    <!-- 
    .zoom {
    height:400px;
    margin:auto;
    }
    .zoom p {
    text-align:center;
    }
    .zoom img {
    width:232px;
    height:275px;
    }
    .zoom img:hover {
    width:250px;
    height:296px;
    }
     
    -->
    </style>
    </head>
     
    <body>
    <div class="zoom">
    <center>
     
    <span Title="PIERRES-INFO"><a href="http://www.pierres-info.fr/accueil/index.html"><img src="antoine_fargette.jpg"></a></span>
    <span Title="PIERRES-INFO"><a href="http://www.pierres-info.fr/accueil/index.html"><img src="antoine_fargette.jpg"></a></span>
    <span Title="PIERRES-INFO"><a href="http://www.pierres-info.fr/accueil/index.html"><img src="antoine_fargette.jpg"></a></span>
    <span Title="PIERRES-INFO"><a href="http://www.pierres-info.fr/accueil/index.html"><img src="antoine_fargette.jpg"></a></span><br>
    <span Title="PIERRES-INFO"><a href="http://www.pierres-info.fr/accueil/index.html"><img src="antoine_fargette.jpg"></a></span>
    <span Title="PIERRES-INFO"><a href="http://www.pierres-info.fr/accueil/index.html"><img src="antoine_fargette.jpg"></a></span>
    <span Title="PIERRES-INFO"><a href="http://www.pierres-info.fr/accueil/index.html"><img src="antoine_fargette.jpg"></a></span>
    <span Title="PIERRES-INFO"><a href="http://www.pierres-info.fr/accueil/index.html"><img src="antoine_fargette.jpg"></a></span>
    </center>
    </div>
    </body>
    </html
    Ce que ça donne actuellement en image (décalages) :Nom : Capturer.JPG
Affichages : 168
Taille : 73,1 Ko

    Merci pour votre aide
    ROMAIN

  2. #2
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Novembre 2016
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Saône (Franche Comté)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Novembre 2016
    Messages : 7
    Points : 2
    Points
    2
    Par défaut Suite
    Bon,
    Mon affaire n'a pas l'air de passionner les foules...
    Alors j'ai cherché comme un grand et j'ai modifié mon code; seul problème qui paraît récurent mais dont je n'ai pas encore trouvé la solution malgré mes recherches et une bonne prise de tête, c'est comment centrer mes images dans le bloc...
    Voici le code (j'ai laissé volontairement le cadre du bloc visible pour voir le problème de centrage) :
    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
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
    <head>
    <style type="text/css">
    .conteneur_images
    {
    background:;
    border: 1px ridge violet;
    height: 176px;
    margin-left: 5%;
    margin-right: 5%;
    width: auto;
    }
     
    .image
    { 
    float: left;
    width: 140px;
    height: 166px;
    margin: 5px;
    }
     
    img#zoom
    {
    height: 100%;
    width: 100%;
    }
     
    img#zoom:hover
    {
    background:#fef9e7;
    height:150%;
    left:-10px;
    padding: 2px;
    position: relative;
    top: -60px;
    width: 200%;
    box-shadow:
    5px 5px 7px #f9e79f;
    }</style>
    </head>
     
    <body>
    <div class="conteneur_images">
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div></div>
    <div class="conteneur_images">
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    <div class="image" id="image"><a href="http://www.pierres-info.fr/accueil/index.html"><img id="zoom" src="antoine_fargette.jpg" title="ANTOINE FARGETTE" alt="Mon Chat photo 2"></a></div>
    </div><br>
    </div>		
    </body>
    </html>
    Et en image : Nom : Capturer.JPG
Affichages : 132
Taille : 62,4 Ko
    Merci pour votre aide, si ti plait missieu
    ROMAIN

  3. #3
    Invité
    Invité(e)
    Par défaut
    Bonjour,

    un effet sympa :
    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
    .conteneur_images {
      margin: 5px;
      width: auto;
    }
     
    .image {
      float: left;
      width: 140px;
      height: 140px;
      margin: 5px;
      overflow: hidden;
    }
    .image:hover {
      overflow: visible;
    }
    img#zoom {
      min-width: 100%;
      min-height: 100%;
      max-width: 200px;
      max-height: 200px;
      -webkit-transition: all 0.5s ease;
      -moz-transition: all 0.5s ease;
      -ms-transition: all 0.5s ease;
      -o-transition: all 0.5s ease;
      transition: all 0.5s ease;
    }
     
    img#zoom:hover {
      box-shadow: 5px 5px 7px #333;
      -webkit-transform: scale(1.5) rotate(-3deg);
      -moz-transform: scale(1.5) rotate(-3deg);
      -o-transform: scale(1.5) rotate(-3deg);
      transform: scale(1.5) rotate(-3deg);
    }
    Dernière modification par Invité ; 30/11/2016 à 16h40.

  4. #4
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Novembre 2016
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Saône (Franche Comté)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Novembre 2016
    Messages : 7
    Points : 2
    Points
    2
    Par défaut
    Merci
    Effectivement très chouette, j'achète...
    Mais mes images ne sont toujours pas centrées dans le container, barnacle !...

  5. #5
    Invité
    Invité(e)
    Par défaut
    Comme ça alors : http://codepen.io/jreaux62/pen/ObOZKM

    J'ai aussi modifié le HTML (car un id est TOUJOURS unique, et ici, on n'en a pas besoin !) :

    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
    <div class="conteneur_images">
      <figure>
        <a href="#"><img src="http://www.gettyimages.fr/gi-resources/images/Embed/new/embed2.jpg" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="http://french.xinhuanet.com/titlepic/135151130_1456974222920_title1n.jpg" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="http://www.gettyimages.com/gi-resources/images/Olympics/Rio2016OlympicHub/olympichair_GettyImages-591810506.jpg" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="http://www.developpez.net/forums/avatars/256045-jreaux62.gif?dateline=1475568296" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="https://twistedsifter.files.wordpress.com/2016/03/popular-images-with-a-twist-by-tony-futura-13.jpg" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="https://cdn.pixabay.com/photo/2016/07/30/13/16/dandelion-1557110_960_720.jpg" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="http://www.developpez.net/forums/avatars/256045-jreaux62.gif?dateline=1475568296" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="http://www.forumdesimages.fr/media/cache/fdi_big_overview/media/fdi/35786-prog-stuart-little-_-christophel-1.jpg" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="http://www.developpez.net/forums/avatars/256045-jreaux62.gif?dateline=1475568296" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="http://www.developpez.net/forums/avatars/256045-jreaux62.gif?dateline=1475568296" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="http://www.developpez.net/forums/avatars/256045-jreaux62.gif?dateline=1475568296" alt=""></a>
      </figure>
      <figure>
        <a href="#"><img src="http://www.developpez.net/forums/avatars/256045-jreaux62.gif?dateline=1475568296" alt=""></a>
      </figure>
    </div>

    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
    .conteneur_images {
      text-align: center;
      max-width: 960px;
      margin: 5px auto;
    }
     
    .conteneur_images figure {
      text-align: center;
      display: inline-block;
      width: 140px;
      height: 140px;
      margin: 5px;
      overflow: hidden;
      position: relative;
    }
     
    .conteneur_images figure:hover {
      overflow: visible;
    }
     
    .conteneur_images figure img {
      position: absolute;
      top: 0;
      left: 0;
      min-width: 100%;
      min-height: 100%;
      max-width: 200px;
      max-height: 200px;
      -webkit-transition: all 0.5s ease;
      -moz-transition: all 0.5s ease;
      -ms-transition: all 0.5s ease;
      -o-transition: all 0.5s ease;
      transition: all 0.5s ease;
    }
     
    .conteneur_images figure img:hover {
      z-index: 2;
      box-shadow: 5px 5px 7px #333;
      -webkit-transform: scale(1.5) rotate(-3deg);
      -moz-transform: scale(1.5) rotate(-3deg);
      -o-transform: scale(1.5) rotate(-3deg);
      transform: scale(1.5) rotate(-3deg);
    }
    Dernière modification par Invité ; 30/11/2016 à 17h37.

  6. #6
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Novembre 2016
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Saône (Franche Comté)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Novembre 2016
    Messages : 7
    Points : 2
    Points
    2
    Par défaut
    C'est parfait centré et magnifique !...
    Un grand merci, je vais pouvoir ranger l'aspirine dans l'armoire...

  7. #7
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Novembre 2016
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Saône (Franche Comté)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Novembre 2016
    Messages : 7
    Points : 2
    Points
    2
    Par défaut
    Arch !... C'était trop beau, tout fonctionnait à la perfection sous Mozilla, mais en faisant un essai sur IE (9 chez moi) rien ne va plus...
    Voilà en image ce que cela donne :
    Nom : Capture.JPG
Affichages : 149
Taille : 70,3 Ko

    Une solution existe-t-elle ?...
    Merci pour vos infos
    ROMAIN

  8. #8
    Invité
    Invité(e)
    Par défaut
    Oui.

    Désinstaller I.E. (I.E.9.... pfff...)


    N.B. Ca fonctionne correctement sur Firefox, Opera, Chrome et Edge.

  9. #9
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Novembre 2016
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Saône (Franche Comté)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Novembre 2016
    Messages : 7
    Points : 2
    Points
    2
    Par défaut
    OK mais étant donné que c'est pour afficher sur mon site, ça va être compliqué de demander à tout le monde de désinstaller IE pour Mozilla...
    Il n'y a donc pas de solution, même autre ?...

  10. #10
    Invité
    Invité(e)
    Par défaut
    Plusieurs solution :

    1/ écrire un CSS de substitution spécialement pour IE (ou plusieurs, en fonction des versions, toutes plus ou moins pourries...)

    2/ utiliser un script/plugin JavaScript/jQuery : "galerie images jQuery"

    3/ Dire "m...." à ceux qui utilisent encore I.E.

  11. #11
    Candidat au Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Novembre 2016
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Saône (Franche Comté)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Novembre 2016
    Messages : 7
    Points : 2
    Points
    2
    Par défaut
    Ok Merci je leur dirais...

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

Discussions similaires

  1. [XL-2007] Besoin d'aide pour améliorer mon code copier-coller
    Par capi81 dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 31/07/2014, 16h14
  2. [VB.NET] besoin d'aide pour déchiffrer un code
    Par pcdj dans le forum Windows Forms
    Réponses: 10
    Dernier message: 27/06/2006, 11h32
  3. Besoin d aide pour comprendre un code
    Par litlebasic dans le forum Delphi
    Réponses: 4
    Dernier message: 22/06/2006, 13h00
  4. Je besoin d'aide pour terminer mon code
    Par Paulinho dans le forum C++
    Réponses: 7
    Dernier message: 06/11/2005, 23h30
  5. Besoin d'aide pour amélioration de regxp
    Par shinux2004 dans le forum Langage
    Réponses: 10
    Dernier message: 03/09/2005, 16h16

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