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 :

Ouverture fermeture d'une DIV dynamiquement sans JQuery


Sujet :

JavaScript

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    97
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 97
    Points : 47
    Points
    47
    Par défaut Ouverture fermeture d'une DIV dynamiquement sans JQuery
    Bonjour,

    voici mon code complet :

    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
    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <title>Progressiv_Div</title>
    <style type="text/css">
    html, body, * {
            margin: 0;
            padding: 0;
    }
    body {
            font-family: helvetica;
    }
    #global {
            display: block;
            margin: 50px;
    }
    #dv {
            display: none;
            margin: 20px 0;
            padding: 10px;
            width: 400px;
            border: 1px solid #000;
            height: auto;
            overflow: hidden;
    }
    </style>
    <script type="text/javascript">
     
    var prg = function() {
     
            this.div;
        this.osh;
        this.ind = 0;
        var that = this;
     
        this.action = function()
            {
                    if (that.ind <= that.osh)
                    {
                            that.ind += 2;
                            that.div.style.height = that.ind + "px";
                            setTimeout(that.action, 10);
                    }
                    else
                    { 
                     that.ind = 0; 
                    }
            }; 
    };
     
    function ouvrir(ref) {
            var nprg = new prg();
     
        nprg.div = document.getElementById(ref);
        nprg.div.style.display = "block";
        nprg.osh = nprg.div.offsetHeight;
        nprg.div.style.height = "0px";
        nprg.action();
    }
     
     
     
     
    function ferme(ref) {
     
    /*là je ne sais pas comment faire */ 
     
     
    }
     
     
     
    function visibilite(thingId)
    {
            var targetElement;
            
            targetElement = document.getElementById(thingId);
            
            if (targetElement.style.display == "none")
            {
                    ouvrir('dv');
                    
                    document.getElementById('a').innerHTML = 'Fermer le cadre ...';
                    
            }
            else
            {
                    ferme('dv');
     
                    document.getElementById('a').innerHTML = 'Ouvrir le cadre ...'; 
            }
    }
    </script>
    </head>
    <body>
    <div id="global">
      <div id="dv" style="display:none">
        <h1>contenu</h1>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>
      </div>
    </div>
    <a id="a" href="javascript:visibilite('dv');">Ouvrir le cadre ...</a>
    </body>
    </html>

    l'ouverture de la DIV fonctionne bien ... Par contre pour la fermeture (ligne 67 j'ai testé des solutions en m'inspirant de la fonction ouvrir mais je n'y arrive pas.
    Quelqu'un peut-il m'aider ?

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

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 218
    Points : 406
    Points
    406
    Par défaut
    Salut zouetchou,

    Et comme çà ?
    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
    <!doctype html>
    <html lang="en">
     
        <head>
            <meta charset="utf-8" />
            <title>Progressiv_Div</title>
            <style>
            body {
                font-family: helvetica;
                margin-left: 20px;
            }
     
            #global {
                margin: 50px;
            }
     
            #dv {
                margin: 20px 0;
                padding: 10px;
                width: 400px;
                border: 1px solid #000;
                overflow: hidden;
            }
        </style>
        </head>
     
        <body>
            <div id="global">
                <div id="dv" style="display: none; max-height: 280px;">
                    <h1>contenu</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s, when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of Lorem
                        Ipsum</p>
                </div>
            </div>
            <a id="a" href="javascript:visibilite('dv');">Ouvrir le cadre ...</a>
     
            <script>
            var ind = osh = parseInt(document.getElementById('dv').style.maxHeight)
     
            var prg = function () {
                this.div;
                var that = this;
     
                this.actionOpen = function () {
                    if (ind < osh) {
                        ind += 2
                        that.div.style.height = ind + "px";
                        setTimeout(that.actionOpen, 10);
                    }
                }
     
                this.actionClose = function () {
                    if (ind > 0) {
                        ind -= 2;
                        that.div.style.height = ind + "px";
                        setTimeout(that.actionClose, 10);
                    } else {
                        that.div.style.display = "none"
                    }
                }
            }
     
            function ouvrir(ref) {
                console.log(ind)
                let nprg = new prg();
                nprg.div = document.getElementById(ref);
                nprg.div.style.display = "block";
                ind = 0
                nprg.actionOpen();
            }
     
            function ferme(ref) {
                console.log(ind)
                let nprg = new prg();
                nprg.div = document.getElementById(ref);
                ind = nprg.div.offsetHeight
                nprg.actionClose();
            }
     
            function visibilite(thingId) {
                let targetElement = document.getElementById(thingId),
                openclose = document.getElementById('a')
     
                openclose.innerText == 'Ouvrir le cadre ...' ? [
                    openclose.innerText = 'Fermer le cadre ...',
                    ouvrir('dv')
                ] :
                    [openclose.innerText = 'Ouvrir le cadre ...',
                    ferme('dv')
                    ]
            }
        </script>
     
        </body>
     
    </html>

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    97
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 97
    Points : 47
    Points
    47
    Par défaut
    Bonjour ASCIIDEFOND,

    Cela fonctionne bien. Merci pour votre réponse et votre rapidité.
    Si je peux me permettre ... est-il possible de faire en sorte que l'on puisse refermer la DIV en cliquant sur le lien pendant son ouverture et à l'inverse rouvrir la DIV en cliquant sur le lien pendant sa fermeture ?

  4. #4
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    97
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 97
    Points : 47
    Points
    47
    Par défaut
    Comment faire également pour ouvrir des DIV différentes sur la même page sans réécrire les fonctions javascript à chaque fois ?

    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
    <!doctype html>
    <html lang="en">
     
        <head>
            <meta charset="utf-8" />
            <title>Progressiv_Div</title>
            <style>
            body {
                font-family: helvetica;
                margin-left: 20px;
            }
     
            #global {
                margin: 50px;
            }
     
            #dv {
                margin: 20px 0;
                padding: 10px;
                width: 400px;
                border: 1px solid #000;
                overflow: hidden;
            }
        </style>
        </head>
     
        <body>
        	<a id="a" href="javascript:visibilite('dv');">Ouvrir le cadre ...</a><br/>
            <a id="b" href="javascript:visibilite('dv2');">Ouvrir le cadre ...</a>
            <div id="global">
                <div id="dv" style="display: none; max-height: 280px;">
                    <h1>contenu 1</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s, when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of Lorem
                        Ipsum</p>
                </div>
                <div id="dv2" style="display: none; max-height: 280px;">
                    <h1>contenu 2</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s, when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of Lorem
                        Ipsum</p>
                </div>
     
            </div>
            <script>
            var ind = osh = parseInt(document.getElementById('dv').style.maxHeight)
     
            var prg = function () {
                this.div;
                var that = this;
     
                this.actionOpen = function () {
                    if (ind < osh) {
                        ind += 2
                        that.div.style.height = ind + "px";
                        setTimeout(that.actionOpen, 10);
                    }
                }
     
                this.actionClose = function () {
                    if (ind > 0) {
                        ind -= 2;
                        that.div.style.height = ind + "px";
                        setTimeout(that.actionClose, 10);
                    } else {
                        that.div.style.display = "none"
                    }
                }
            }
     
            function ouvrir(ref) {
                console.log(ind)
                let nprg = new prg();
                nprg.div = document.getElementById(ref);
                nprg.div.style.display = "block";
                ind = 0
                nprg.actionOpen();
            }
     
            function ferme(ref) {
                console.log(ind)
                let nprg = new prg();
                nprg.div = document.getElementById(ref);
                ind = nprg.div.offsetHeight
                nprg.actionClose();
            }
     
            function visibilite(thingId) {
                let targetElement = document.getElementById(thingId),
                openclose = document.getElementById('a')
     
                openclose.innerText == 'Ouvrir le cadre ...' ? [
                    openclose.innerText = 'Fermer le cadre ...',
                    ouvrir('dv')
                ] :
                    [openclose.innerText = 'Ouvrir le cadre ...',
                    ferme('dv')
                    ]
            }
        </script>
     
        </body>
     
    </html>

    Merci pour votre aide,

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

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 218
    Points : 406
    Points
    406
    Par défaut
    Citation Envoyé par zouetchou Voir le message
    ...est-il possible de faire en sorte que l'on puisse refermer la DIV en cliquant sur le lien pendant son ouverture et à l'inverse rouvrir la DIV en cliquant sur le lien pendant sa fermeture ?
    Pour ça ce n'est pas encore au point, je cherche.

    Sinon pour plusieurs DIV différentes sur le même page.
    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
    <!doctype html>
    <html lang="en">
     
    <head>
        <meta charset="utf-8" />
        <title>Progressiv_Div</title>
        <style>
            body {
                font-family: helvetica;
                margin-left: 20px;
            }
     
            #global {
                display: grid;
                grid-template-columns: repeat(3, 1Fr);
            }
     
            .dv {
                position: relative;
                padding: 10px;
                width: 400px;
                border: 1px solid #000;
                overflow: hidden;
                height: 0px;
                margin: 0 auto;
            }
     
            .parent-dv {
                height: 340px;
            }
     
            .bouton {
                width: max-content;
                height: 30px;
                font-weight: bold;
                margin: 0 auto;
                display: block;
                border: none;
                background-color: transparent;
                cursor: pointer;
                color: #32bbf2;
                font-size: 1em;
            }
        </style>
    </head>
     
    <body>
        <div id="global">
            <div class="parent-dv">
                <div class="dv" style="display: none; max-height: 280px;">
                    <h1>contenu #1</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s,
                        when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has
                        survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum
                        passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of
                        Lorem
                        Ipsum</p>
                </div>
                <button class="bouton" onclick="action(this)">Ouvrir le cadre
                    ...</button>
            </div>
     
            <div class="parent-dv">
                <div class="dv" style="display: none; max-height: 280px;">
                    <h1>contenu #2</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s,
                        when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has
                        survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum
                        passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of
                        Lorem
                        Ipsum</p>
                </div>
                <button class="bouton" onclick="action(this)">Ouvrir le cadre
                    ...</button>
            </div>
            <div class="parent-dv">
                <div class="dv" style="display: none; max-height: 280px;">
                    <h1>contenu #3</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s,
                        when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has
                        survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum
                        passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of
                        Lorem
                        Ipsum</p>
                </div>
                <button class="bouton" onclick="action(this)">Ouvrir le cadre
                    ...</button>
            </div>
        </div>
     
        <script>
            let mesBoutons = document.querySelectorAll('.bouton'),
                mesDivs = document.querySelectorAll('.dv'), timer
     
            var prg = function () {
                this.div;
                var that = this;
     
                this.actionOpen = function () {
                    if (that.div.ind < that.div.osh) {
                        that.div.ind += 2
                        that.div.style.height = that.div.ind + "px";
                        timer = setTimeout(that.actionOpen, 10);
                    }
                }
     
                this.actionClose = function () {
                    if (that.div.ind > 0) {
                        that.div.ind -= 2;
                        that.div.style.height = that.div.ind + "px";
                        timer = setTimeout(that.actionClose, 10);
                    } else {
                        that.div.style.display = "none"
                    }
                }
            }
     
            function ouvrir(ref) {
                let nprg = new prg()
                nprg.div = ref
                nprg.div.osh = parseInt(nprg.div.style.maxHeight)
                nprg.div.ind = 0
                nprg.div.style.display = "block";
                nprg.actionOpen();
     
            }
     
            function ferme(ref, e) {
                let nprg = new prg();
                nprg.div = ref
                nprg.div.ind = nprg.div.offsetHeight
                nprg.actionClose();
            }
     
            function action(bouton) { // Bouton cliqué
                let parentDiv = bouton.parentElement.children[0]  // DIV correspondante
                bouton.innerText == 'Ouvrir le cadre ...' ? [
                    bouton.innerText = 'Fermer le cadre ...',
                    ouvrir(parentDiv)
                ] :
                    [bouton.innerText = 'Ouvrir le cadre ...',
                    ferme(parentDiv)
                    ]
            }
     
        </script>
     
    </body>
     
    </html>

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

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 218
    Points : 406
    Points
    406
    Par défaut
    Voilà tout fonctionne. J'ai déplacé les boutons en haut des div pour faciliter les cliques pour les ouvertures et fermetures.
    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
    <!doctype html>
    <html lang="en">
     
    <head>
        <meta charset="utf-8" />
        <title>Progressiv_Div</title>
        <style>
            body {
                font-family: helvetica;
                margin-left: 20px;
            }
     
            #global {
                display: grid;
                grid-template-columns: repeat(3, 1Fr);
                gap: 1em;
            }
     
            .dv {
                position: relative;
                padding: 10px;
                width: 400px;
                border: 1px solid #000;
                overflow: hidden;
                margin: 0 auto;
            }
     
            .parent-dv {
                height: 340px;
            }
     
            .bouton {
                width: max-content;
                height: 30px;
                font-weight: bold;
                margin: 0 auto;
                display: block;
                border: none;
                background-color: transparent;
                cursor: pointer;
                color: #32bbf2;
                font-size: 1em;
            }
        </style>
    </head>
     
    <body>
        <div id="global">
            <div class="parent-dv">
                <button class="bouton">Ouvrir le cadre...</button>
                <div class="dv" style="display: none; max-height: 280px;">
                    <h1>contenu #1</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s,
                        when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has
                        survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum
                        passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of
                        Lorem
                        Ipsum</p>
                </div>
            </div>
            <div class="parent-dv">
                <button class="bouton">Ouvrir le cadre...</button>
                <div class="dv" style="display: none; max-height: 280px;">
                    <h1>contenu #2</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s,
                        when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has
                        survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum
                        passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of
                        Lorem
                        Ipsum</p>
                </div>
            </div>
            <div class="parent-dv">
                <button class="bouton">Ouvrir le cadre...</button>
                <div class="dv" style="display: none; max-height: 280px;">
                    <h1>contenu #3</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s,
                        when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has
                        survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum
                        passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of
                        Lorem
                        Ipsum</p>
                </div>
            </div>
        </div>
     
        <script>
            let prg, timer = [], nbPx = 4
     
            prg = function (x) { //x est la valeur du data-index de la div
                let that = this
     
                that.actionOpen = function () {
                    if (that.div.ind < that.div.osh) {
                        that.div.ind += nbPx
                        that.div.style.height = `${that.div.ind}px`
                        timer[x] = setTimeout(that.actionOpen, 10)
                    }
                }
     
                that.actionClose = function () {
                    if (that.div.ind > 0) {
                        that.div.ind -= nbPx
                        that.div.style.height = `${that.div.ind}px`
                        timer[x] = setTimeout(that.actionClose, 10)
                    } else {
                        that.div.style.display = "none"
                    }
                }
            }
     
            function ouvrir(ref, inDx) {
                clearTimeout(timer[inDx]) // stop le setTimeout en cours sur le div sélectionnée
                let nprg = new prg(inDx)
                nprg.div = ref
                nprg.div.osh = parseInt(nprg.div.style.maxHeight)
                nprg.div.ind = ref.offsetHeight
                nprg.div.style.display = "block";
                nprg.actionOpen();
            }
     
            function fermer(ref, inDx) {
                clearTimeout(timer[inDx])
                let nprg = new prg(inDx);
                nprg.div = ref
                nprg.div.ind = nprg.div.offsetHeight
                nprg.actionClose();
            }
     
            document.querySelectorAll('.bouton').forEach((boutonSelect, index) => {
                boutonSelect.addEventListener('click', () => {
                    let parentDiv = boutonSelect.parentElement.children[1]
                    boutonSelect.innerText == 'Ouvrir le cadre...' ? [
                        boutonSelect.innerText = 'Fermer le cadre...',
                        ouvrir(parentDiv, index)
                    ] :
                        [boutonSelect.innerText = 'Ouvrir le cadre...',
                        fermer(parentDiv, index)
                        ]
                })
            })
     
        </script>
     
    </body>
     
    </html>

  7. #7
    Membre du Club
    Homme Profil pro
    IDE
    Inscrit en
    Janvier 2015
    Messages
    39
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire (Rhône Alpes)

    Informations professionnelles :
    Activité : IDE

    Informations forums :
    Inscription : Janvier 2015
    Messages : 39
    Points : 58
    Points
    58
    Par défaut Oui mais...
    Oui, "ça marche" comme on dit. Je vois cependant plusieurs problèmes :
    - C'est JavaSript qui pilote l'animation, donc aucune chance de pouvoir modifier l'animation sans toucher au script.
    - La hauteur du contenu est fixe elle est définie en dur. Si j'ajoute du contenu, ou si je traduis à la volée dans une langue plus verbeuse que la nôtre, je perds du contenu.
    - L'accessibilité est absente.

    Plusieurs solutions :
    - S'en tenir au HTML avec Details/Summary (exemple : Details/Summary). Pour du basique ça reste la meilleure option, car de loin la plus légère puisque native.
    - Utiliser un framework tel que Bootstrap pour ne pas avoir de surprises (Bootstrap, Accordion)
    - Tout coder sois-même reste une option, mais le faire correctement prend du temps (je l'ai fais ici : Scriptura, Accordions). Si vous faites cette option, bon courage car ça prend du temps, mais si vous suivez cette voie vous allez apprendre beaucoup de choses.

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

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 218
    Points : 406
    Points
    406
    Par défaut
    Salut Olivier C,

    Il est certain que mon bout de code est loin d'être la panacée comme solution, mais il fonctionne.
    Maintenant pour le reste, c'est à Zouetchou de voir comment agencer son code soit en pur JavaScript ou avec des frameworks.

  9. #9
    Membre éclairé
    Homme Profil pro
    Urbaniste
    Inscrit en
    Août 2023
    Messages
    386
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations professionnelles :
    Activité : Urbaniste

    Informations forums :
    Inscription : Août 2023
    Messages : 386
    Points : 788
    Points
    788
    Par défaut
    La solution proposée souffre de ce qu'elle utilise la propriété display:none: sur
    les éléments dont on veut calculer la hauteur d'affichage pour ensuite
    la faire varier lors de l'animation.

    Utiliser display:none; empêche d'obtenir la hauteur d'affichage.

    Essentiellement, il faut corriger la structure du HTML, et utiliser la propriété
    height:0; (ou max-height) en compagnie de overflow:hidden.

    Ceci doit permettre, au premier affichage, de masquer les éléments,
    mais, cependant, de toute même pouvoir calculer la hauteur de l'élément
    à atteindre à la première exécution du code javascript.

    Sans déjà fournir de solution clé en main, voici une démo qui illustre
    le problème :

    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
    <html>
      <body>
        <div class="expandable">
          <div class="container-display">
            <div>content</div>
          </div>
          <div class="container-height">
            <div>content</div>
          </div>
        </div>
        <style>
          .expandable{}
          .expandable .container-display{display:none;}
          .expandable .container-height{height:0px;overflow:hidden;}
          .expandable .container-display > div,
          .expandable .container-height > div{
            padding:10px;
            margin:10px;
            border:1px solid black;
          }
        </style>
        <script>
          let el = document.querySelector(".expandable");
          let containerDisplay = el.querySelector(".container-display");
          console.log(containerDisplay.querySelector("div").getBoundingClientRect().height)
          let containerHeight = el.querySelector(".container-height");
          console.log(containerHeight.querySelector("div").getBoundingClientRect().height)
        </script>
      </body>
    </html>

    Ensuite, d'avoir repris la code proposé par le PO est une très mauvaise idée.
    Celui ci est exécrable et nécessite des ajustements plus profond.

    Plutôt que de marcher sur trois jambes avec des variables globale, des fonctions, et des instances,
    il me semble plus judicieux de n'avoir qu'une instanciation qui reçoit en paramètre un élément conteneur.
    Durant le constructeur, faire les sélections d'enfants et autres liaisons d'évènements.
    Prendre garde à toujours utiliser that et non this pour éviter les difficultés de détermination de la valeur pour this.
    On s'évitera par ailleurs l'utilisation de bind qui sera problématique lors du désabonnement des évènements.

    Cette syntaxe qui s'appuie sur l’initialisation d'un tableau pour exécuter plusieurs actions en une ligne est intéressante,
    je ne l'avais jamais rencontrée, cf [ console.log("a"), console.log("b") ];,
    je suggère tout de même d'utiliser les parenthèses.
    Même effet, l'allocation en moins, ( console.log("a"), console.log("b") );.

    Au lieu de setTimeout(..., 10) il faudrait considérer requestAnimationFrame(...),
    cependant le code ne peut plus s'appuyer sur clearTimeout pour arrêter l'animation en cours.
    Plutôt de s'appuyer sur une boucle de rappel pour chaque animation.
    Il faudrait s'appuyer sur une boucle de rappel unique qui utilise un booléen pour savoir si il faut agrandir ou réduire.
    Comme précédemment, continuer la boucle de rappel tant que la condition de sortie n'est pas atteinte.

    https://developer.mozilla.org/en-US/...AnimationFrame

    Le constructeur prg est mal fichu. Il devrait être const.
    Il devrait vérifier qu'il est instancié par l'utilisation du mot clé new pour s'éviter des problèmes.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
      const prg = function (el) {
        if (!(this instanceof prg)) return new prg(el); // corriger automatiquement l'appel sans constructeur.
        // Voir aussi, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target
    En conséquence, on pourra écrire du code tel que

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    document.querySelectorAll("...").forEach(prg);
    Éventuellement, on peut s'appuyer sur l'api MutationObserver pour déclarer un destructeur lorsque le noeud est supprimé de l'arbre.
    https://developer.mozilla.org/en-US/...tationObserver

    Finalement, cette version qui utilise des instances nécessite un tas de code supplémentaire dont il faudrait discuter de la pertinence,
    je suggère de poursuivre l'utilisation de la syntaxe qui s'appuyait sur la déclaration
    d'un évènement via l'attribut du bouton pour produire une version très épurée.
    IE: href="javascript:visibilite('...sélecteur css');".



    On peut aussi considérer une version js-less en s'appuyant sur les pseudo sélecteur :target et :has.



    Bref, pas besoin de framework.

  10. #10
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    97
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 97
    Points : 47
    Points
    47
    Par défaut
    Bonjour à tous,

    merci beaucoup pour vos réponses.

    Je n'ai pas tout compris mais le contenu de mes cadres sera limité en contenu donc que les dimensions soit en dur ne pose pas vraiment de problèmes mais nécessaires pour le calcul de la hauteur des div effectivement. En plus j'ai besoin d'adapter la hauteur en fonction de la largeur de la fenêtre du navigateur donc je teste des truc et j'ai adapté comme cela :

    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
    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
    <!doctype html>
    <html lang="fr">
    <head>
        <meta charset="utf-8" />
        <title>Progressiv_Div</title>
        <style>
            body {
                font-family: helvetica;
                margin-left: 20px;
            }
     
            #global {
                display: inline-block;
                            /*border:solid 3px #F00;*/
                            /*display: grid;
                grid-template-columns: repeat(3, 1Fr);
                gap: 1em;*/
            }
                    
            .parent-dv {
                height:auto;
                            /*border:solid 2px #FF0;*/
            }
     
            .dv {
                            display:none;
                            
                position: relative;
                padding: 10px;
                    margin: 0 auto;
                        width: 400px;
                border: 1px solid;
                overflow: hidden;
            }
     
            .bouton {
                width: max-content;
                height: 30px;
                font-weight: bold;
                margin: 0 auto;
                display: block;
                border: none;
                background-color: transparent;
                cursor: pointer;
                color: #32bbf2;
                font-size: 1em;
            }
        </style>
    </head>
     
    <body>
        <div id="global">
            <div class="parent-dv">
                <button class="bouton">Ouvrir le cadre...</button>
                <div class="dv" style="max-height: 280px;">
                    <h1>contenu #1</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s,
                        when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has
                        survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum
                        passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of
                        Lorem
                        Ipsum</p>
                </div>
            </div>
            <div class="parent-dv">
                <button class="bouton">Ouvrir le cadre...</button>
                <div class="dv" style="max-height: 280px;">
                    <h1>contenu #2</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s,
                        when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has
                        survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum
                        passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of
                        Lorem
                        Ipsum 
                        </p>
                        <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s,
                        when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has
                        survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum
                        passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of
                        Lorem
                        Ipsum</p> 
                </div>
            </div>
            <div class="parent-dv">
                <button class="bouton">Ouvrir le cadre...</button>
                <div class="dv" style="max-height: 280px;">
                    <h1>contenu #3</h1>
                    <p>Lorem Ipsum is simply dummy text of the printing and
                        typesetting industry. Lorem Ipsum has been the
                        industry s standard dummy text ever since the 1500s,
                        when an
                        unknown printer took a galley of type and
                        scrambled it to make a type specimen book. It has
                        survived
                        not only five centuries, but also the leap
                        into electronic typesetting, remaining essentially
                        unchanged. It was popularised in the 1960s with the
                        release of Letraset sheets containing Lorem Ipsum
                        passages,
                        and more recently with desktop publishing
                        software like Aldus PageMaker including versions of
                        Lorem
                        Ipsum</p>
                </div>
            </div>
        </div>
    <script>
     
    // On adapte la DIV en fonction de la taille de la fenêtre
    div_resize();
     
    // On adapte la DIV en fonction de la taille de la fenêtre
    function div_resize()
    {
            // On détermine les dimentions de la fenêtre
            var largeur = window.innerWidth;
     
            // On recense tous les div ayant la classe 'dv'
            var testElements = document.getElementsByClassName("dv");
            
            // On compte le nombre de div dans le tableau
            var nbr_elements = testElements.length;
            
            // Pour chaque résulat ...
            for(i=0; i < nbr_elements; i++)
            {
                    // ... on adapte les dimentions de la Div
                    if(largeur <700)
                    {
                            testElements[i].style.maxHeight = 500+'px';
                    }
                    else if(largeur <1000)
                    {
                            testElements[i].style.maxHeight = 350+'px';
                    }
                    else if(largeur >= 1000)
                    {
                            testElements[i].style.maxHeight = 280+'px';
                    }
                    
                    //var test = testElements[i].style.maxHeight;
                    //alert(test);
            }
    }
     
            let prg, timer = [], nbPx = 4
     
            prg = function (x) { //x est la valeur du data-index de la div
                let that = this
     
                that.actionOpen = function () {
                    if (that.div.ind < that.div.osh) {
                        that.div.ind += nbPx
                        that.div.style.height = `${that.div.ind}px`
                        timer[x] = setTimeout(that.actionOpen, 10)
                    }
                }
     
                that.actionClose = function () {
                    if (that.div.ind > 0) {
                        that.div.ind -= nbPx
                        that.div.style.height = `${that.div.ind}px`
                        timer[x] = setTimeout(that.actionClose, 10)
                    } else {
                        that.div.style.display = "none"
                    }
                }
            }
     
            function ouvrir(ref, inDx) {
                clearTimeout(timer[inDx]) // stop le setTimeout en cours sur le div sélectionnée
                let nprg = new prg(inDx)
                nprg.div = ref
                nprg.div.osh = parseInt(nprg.div.style.maxHeight)
                nprg.div.ind = ref.offsetHeight
                nprg.div.style.display = "block";
                nprg.actionOpen();
            }
     
            function fermer(ref, inDx) {
                clearTimeout(timer[inDx])
                let nprg = new prg(inDx);
                nprg.div = ref
                nprg.div.ind = nprg.div.offsetHeight
                nprg.actionClose();
            }
     
            document.querySelectorAll('.bouton').forEach((boutonSelect, index) => {
                boutonSelect.addEventListener('click', () => {
                    let parentDiv = boutonSelect.parentElement.children[1]
                    boutonSelect.innerText == 'Ouvrir le cadre...' ? [
                        boutonSelect.innerText = 'Fermer le cadre...',
                        ouvrir(parentDiv, index)
                    ] :
                        [boutonSelect.innerText = 'Ouvrir le cadre...',
                        fermer(parentDiv, index)
                        ]
                })
            })
                    
    // Fonction permettant de détecter le redimentionnement de la fenêtre
    function handle(){ 
            
            // On adapte la DIV en fonction de la taille de la fenêtre
            div_resize();   
    }
     
    // Si redimentionnement de la fenêtre
    window.onresize = handle;
     
    </script>
    </body>
    </html>

  11. #11
    Membre du Club
    Homme Profil pro
    IDE
    Inscrit en
    Janvier 2015
    Messages
    39
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire (Rhône Alpes)

    Informations professionnelles :
    Activité : IDE

    Informations forums :
    Inscription : Janvier 2015
    Messages : 39
    Points : 58
    Points
    58
    Par défaut Pas de JavaScript pour l'animation
    +1 avec unanonyme pour max-height (ou tout simplement height). Mais votre problème de hauteur vient du fait que vous la définissez en permanence. Si vous ne définissez pas de hauteur vous ne serez pas obligé de passer par des artifices pour trouver une hauteur de compromis selon la largeur de l'écran. Ce qu'il faut c'est utiliser, par exemple max-height, seulement pour le moment de l'animation et le supprimer ensuite :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
      const openedPanel = panel => {
        panel.style.maxHeight = `${panel.scrollHeight}px`
        panel.addEventListener('transitionend', () => panel.removeAttribute('style'))
        panel.ariaHidden = 'false'
      }
     
      const closedPanel = panel => {
        // @note Redéfinition de la hauteur du panneau avant la suppression de cette même définition un laps de temps plus tard. Le laps de temps est minime mais suffisant pour être pris en compte par la transition CSS.
        panel.style.maxHeight = `${panel.scrollHeight}px`
        setTimeout(() => {
          panel.removeAttribute('style')
          ;(panel.ariaHidden = 'true'), 1
        })
      }
    Comme je l'ai dit plus haut, je ne m'embêterais pas avec JavaScript pour l'animation, avec la gestion des états et tout le basar (interruption de l'animation, etc) alors qu'une transition CSS le fera bien mieux, sans rien devoir suivre, et de manière d'autant plus optimisée par les navigateurs que c'est natif. En JavaScript on ne fera que tenter de reproduire un comportement en moins bien. Perso, pour le front, j'utilise JavaScript lorsqu'il est nécessaire et CSS par défaut pour tout le reste. Donc, de même que `scroll-behavior: smooth` a remplacé les dizaines de lignes de code JS nécessaires lorsque l'on cherchait à faire un défilement fluide à l'époque, depuis longtemps maintenant, pour ouvrir/fermer un élément on se contentera de ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    .maClassePourMonContenu {
        overflow: hidden;
        transition: max-height 0.5s ease-in-out; /* <= tout le secret est ici... juste une transition */
     
        &[aria-hidden='true'] {
          max-height: 0;
    }
    Et c'est tout. Le reste du CSS... c'est du design. On laissera le soin à JavaScript de produire les attributs aria (plutôt que des classes : j'avais parlé d'accessibilité plus haut, alors autant s'appuyer sur des attributs aria que sur une classe).

    Les extraits de code sont issus de l'exemple perso que j'avais proposé plus haut : Accordions.
    Si ça vous intéresse de voir l'ensemble du code JavaScript qui fait tourner la démo, c'est ici : Github.

  12. #12
    Membre éclairé
    Homme Profil pro
    Urbaniste
    Inscrit en
    Août 2023
    Messages
    386
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations professionnelles :
    Activité : Urbaniste

    Informations forums :
    Inscription : Août 2023
    Messages : 386
    Points : 788
    Points
    788
    Par défaut
    Je rejoins l'avis précédent, cela fait longtemps que l'on a abandonné les animations en javascript.

    aria-hidden c'est très bien.

    Les transitions css, c'est très bien aussi.

    Les media queries, c'est aussi, très bien.

    Dans l'absolu la délégation d'évènement, c'est vraiment bien.

    Cependant, il m'apparaît nécessaire d'appuyer sur l'usage de la propriété height,
    max-height est une rustine pour le cas particulier d'une version js-less (c'est vraiment une grosse rustine).

    Dans le cas plus particulier de PO, utiliser height pour animer, max-height pour contraindre via des mediaqueries.
    Dans la version la plus efficace et la plus simple,
    ça devrait tenir en 20 lignes de script, et une une autre 20aine de lignes de style.

    Je suggère fortement de s'appliquer à nommer les choses avec attention et clarté.
    Les trucs id=dv, id=global ou class=parent-dv sont voués à l'échec.

    accordion / accordion-panel ou accordion-content c'est déjà plus clair.
    J'ai une préférence pour expandable / expandable-container.
    N'importe quoi tant que cela apporte du sens et du contexte sous peine d'ajouter à vos malheurs.

    L'indentation est votre ami.... N'hésitez pas à recommencer de zéro pour tester et valider un mécanisme particulier,
    ou pour aborder le problème avec une méthode totalement différente.
    Ne soyez pas monomaniaque du javascript.

    https://developer.mozilla.org/fr/doc...SS_transitions

    https://developer.mozilla.org/fr/doc..._media_queries

    https://developer.mozilla.org/fr/doc...ion_dévénement

    https://developer.mozilla.org/en-US/...lement/matches

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

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 218
    Points : 406
    Points
    406
    Par défaut
    Citation Envoyé par zouetchou Voir le message
    ...Je n'ai pas tout compris mais le contenu de mes cadres sera limité en contenu donc que les dimensions soit en dur ne pose pas vraiment de problèmes mais nécessaires pour le calcul de la hauteur des div effectivement...
    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
    <!doctype html>
    <html lang="en">
     
    <head>
      <meta charset="utf-8" />
      <title>Progressiv_Div</title>
      <style>
        * {
          box-sizing: border-box;
        }
     
        body {
          background-color: #383737;
        }
     
        .dv {
          transition: height .80s ease-in;
          overflow: hidden;
          max-width: 800px;
          border: 1px solid grey;
          font-size: 1em;
          color: #ffffff;
        }
     
        h1 {
          margin: 0 0 0 10px;
        }
     
        p {
          padding: 10px;
        }
     
        .dv:not(.active) {
          display: none;
        }
     
        .disabled {
          pointer-events: none;
          opacity: 0.2;
        }
     
        .bouton {
          width: max-content;
          height: 30px;
          font-weight: bold;
          display: block;
          border: none;
          background-color: transparent;
          cursor: pointer;
          color: #0399d4;
          font-size: 1em;
        }
      </style>
    </head>
     
    <body>
     
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>contenu #1</h1>
        <p></p>
      </div>
     
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>contenu #2</h1>
        <p></p>
      </div>
     
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>contenu #3</h1>
        <p></p>
      </div>
     
      <script>
        let prg, timer = [], heights = [],
          texte = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry s standard dummy text ever since the 1500s, when an  unknown printer took a galley of type and scrambled it to make a type specimen book.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum"
     
        prg = function (x) {
          let that = this
     
          that.openClose = function () {
     
            if (!that.div.classList.contains('active')) {
              that.div.classList.add('active')
              that.bout.innerText = 'Fermer le cadre...'
              that.div.style.height = 'auto'
     
              heights[x] = `${that.div.clientHeight}px`
              that.div.style.height = '0px'
     
              timer[x] = setTimeout(function () {
                that.div.style.height = heights[x]
              }, 0)
            } else {
              that.bout.classList.add('disabled')
              that.div.style.height = '0px'
     
              that.div.addEventListener('transitionend', function () {
                that.div.classList.remove('active')
                that.bout.classList.remove('disabled')
                that.bout.innerText = 'Ouvrir le cadre...'
              }, {
                once: true
              })
            }
          }
        }
     
        for (let baliseP of document.querySelectorAll('div > p')) {
          baliseP.innerText = texte
        }
     
        document.querySelectorAll('.bouton').forEach((boutonSelect, index) => {
          boutonSelect.addEventListener('click', function (event) {
            event.preventDefault();
     
            let nprg = new prg(index)
            nprg.div = document.querySelectorAll('.dv')[index]
            nprg.bout = boutonSelect
            nprg.openClose(index)
          })
        })
     
        onresize = (event) => {
          for (let divs of document.querySelectorAll('.dv')) {
            divs.style.height = 'auto';
            divs.style.height = divs.clientHeight + 'px'
          }
        }
     
      </script>
     
    </body>
     
    </html>

  14. #14
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    97
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 97
    Points : 47
    Points
    47
    Par défaut
    Bonsoir ASCIIDEFOND,

    Merci pour ce nouveau code. J'étais en train de me rabattre sur le 100% CSS mais d'autres problèmes de fonctionnement se présentent.
    J'ai modifié le code pour tester le redimensionnement de la fenêtre et accepter du texte HTML dans les DIV (ligne 129).

    Du coup je croie que je vais peut être rester sur JS. Cependant un problème se pose ... Dans votre code les trois DIV contiennent le même texte... Ce ne sera pas le cas.

    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
    <!doctype html>
    <html lang="en">
     
    <head>
      <meta charset="utf-8" />
      <title>Progressiv_Div</title>
      <style>
        * {
          box-sizing: border-box;
        }
     
        body {
          background-color: #383737;
        }
            
        .conteneur{
          display:inline-block;
          vertical-align:top;
         }
             
        .dv {
          transition: height .80s ease-in;
          overflow: hidden;
          max-width: 480px;
          border: 1px solid grey;
          font-size: 1em;
          color: #ffffff;
        }
     
        h1 {
          margin: 0 0 0 10px;
        }
     
        p {
          padding: 10px;
        }
     
        .dv:not(.active) {
          display: none;
        }
     
        .disabled {
          pointer-events: none;
          opacity: 0.2;
        }
     
        .bouton {
          /*width: max-content;*/
          width: 500px;
          height: 30px;
          font-weight: bold;
          text-align:left;
     
          border: none;
          background-color: transparent;
          cursor: pointer;
          color: #0399d4;
          font-size: 1em;
        }
            
        @media screen and (max-width: 1000px) {
            .dv,.bouton{
             max-width: 350px;
            }
         }
     
      </style>
    </head>
     
    <body>
     
     <div class="conteneur">
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>contenu #1</h1>
        <p></p>
      </div>
     </div>
      <div class="conteneur">
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>contenu #2</h1>
        <p></p>
      </div>
     </div>
      <div class="conteneur">
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>contenu #3</h1>
        <p></p>
      </div>
     </div>
      <script>
        let prg, timer = [], heights = [],
          texte = "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry s standard dummy text ever since the 1500s, when an  unknown printer took a galley of type and scrambled it to make a type specimen book.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p><p>TEST Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry s standard dummy text ever <strong>since the 1500s</strong>, when an  unknown printer took a galley of type and scrambled it to make a type specimen book.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>"
     
        prg = function (x) {
          let that = this
     
          that.openClose = function () {
     
            if (!that.div.classList.contains('active')) {
              that.div.classList.add('active')
              that.bout.innerText = 'Fermer le cadre...'
              that.div.style.height = 'auto'
     
              heights[x] = `${that.div.clientHeight}px`
              that.div.style.height = '0px'
     
              timer[x] = setTimeout(function () {
                that.div.style.height = heights[x]
              }, 0)
            } else {
              that.bout.classList.add('disabled')
              that.div.style.height = '0px'
     
              that.div.addEventListener('transitionend', function () {
                that.div.classList.remove('active')
                that.bout.classList.remove('disabled')
                that.bout.innerText = 'Ouvrir le cadre...'
              }, {
                once: true
              })
            }
          }
        }
     
        for (let baliseP of document.querySelectorAll('div > p')) {
          baliseP.innerHTML = texte
        }
     
        document.querySelectorAll('.bouton').forEach((boutonSelect, index) => {
          boutonSelect.addEventListener('click', function (event) {
            event.preventDefault();
     
            let nprg = new prg(index)
            nprg.div = document.querySelectorAll('.dv')[index]
            nprg.bout = boutonSelect
            nprg.openClose(index)
          })
        })
     
        onresize = (event) => {
          for (let divs of document.querySelectorAll('.dv')) {
            divs.style.height = 'auto';
            divs.style.height = divs.clientHeight + 'px'
          }
        }
     
      </script>
     
    </body>
     
    </html>

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

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 218
    Points : 406
    Points
    406
    Par défaut
    Dans votre code les trois DIV contiennent le même texte... Ce ne sera pas le cas.

  16. #16
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    97
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 97
    Points : 47
    Points
    47
    Par défaut
    Ai je dis une bêtise ? Il aurait fallu que texte1 s'affiche dans cadre 1, texte2 dans cadre 2...etc.
    Comment faire en l'état ?

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

    Informations professionnelles :
    Activité : Autodidacte passionné

    Informations forums :
    Inscription : Novembre 2002
    Messages : 218
    Points : 406
    Points
    406
    Par défaut
    Pour changer les titres et les textes.
    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
    ...
    <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>Ici un titre</h1>
        <p>Le texte</p>
      </div>
    
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>Ici un titre</h1>
        <p>Le texte</p>
      </div>
    
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>Ici un titre</h1>
        <p>Le texte</p>
      </div>
    ...
      <script>
    
    //Supprimer dans le script tout ce qui est en rouge
        let prg, timer = [], heights = [],  
    texte = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry s standard dummy text ever since the 1500s, when an  unknown printer took a galley of type and scrambled it to make a type specimen book.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum"
    ...
    
        for (let baliseP of document.querySelectorAll('div > p')) {
          baliseP.innerText = texte
        }
    ...
    </script>

    Et si tu veux rajouter du texte, il y a juste à ajouter ces lignes dans le html.
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>Ici un titre</h1>
        <p>Le texte</p>
      </div>

  18. #18
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    97
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 97
    Points : 47
    Points
    47
    Par défaut
    Bonjour,

    j'ai testé en suppriment directement les informations liées à la variable 'texte' et cela fonctionne parfaitement ...

    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
    <!doctype html>
    <html lang="en"> 
    <head>
      <meta charset="utf-8" />
      <title>Progressiv_Div</title>
      <style>
        * {
          box-sizing: border-box;
        }
     
        body {
          background-color: #383737;
        }
            
             .conteneur{
                    display:inline-block;
                    vertical-align:top;
             }
             
        .dv {
          transition: height .80s ease-in;
          overflow: hidden;
          max-width: 480px;
          border: 1px solid grey;
          font-size: 1em;
          color: #ffffff;
        }
     
        h1 {
          margin: 0 0 0 10px;
        }
     
        p {
          padding: 10px;
        }
     
        .dv:not(.active) {
          display: none;
        }
     
        .disabled {
          pointer-events: none;
          opacity: 0.2;
        }
     
        .bouton {
              width: 500px;
          height: 30px;
          font-weight: bold;
              text-align:left;
     
          border: none;
          background-color: transparent;
          cursor: pointer;
          color: #0399d4;
          font-size: 1em;
        }
            
            @media screen and (max-width: 1000px) {
                    .dv,.bouton{
                            max-width: 350px;
                    }
            }
      </style>
    </head>
     
    <body>
     <div class="conteneur">
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>contenu #1</h1>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry s standard dummy text ever <strong>since the 1500s</strong>, when an  unknown printer took a galley of type and scrambled it to make a type specimen book.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>
      </div>
     </div>
      <div class="conteneur">
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>contenu #2</h1>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry s standard dummy text ever since the 1500s, when an  unknown printer took a galley of type and scrambled it to make a type specimen book.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry s standard dummy text ever since the 1500s, when an  unknown printer took a galley of type and scrambled it to make a type specimen book.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>
      </div>
     </div>
      <div class="conteneur">
      <button class="bouton">Ouvrir le cadre...</button>
      <div class="dv">
        <h1>contenu #3</h1>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry s standard dummy text ever since the 1500s, when an  unknown printer took a galley of type and scrambled it to make a type specimen book.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry s standard dummy text ever since the 1500s, when an  unknown printer took a galley of type and scrambled it to make a type specimen book.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry s standard dummy text ever since the 1500s, when an  unknown printer took a galley of type and scrambled it to make a type specimen book.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>
      </div>
     </div>
      <script>
        let prg, timer = [], heights = []
     
        prg = function (x) {
          let that = this
     
          that.openClose = function () {
     
            if (!that.div.classList.contains('active')) {
              that.div.classList.add('active')
              that.bout.innerText = 'Fermer le cadre...'
              that.div.style.height = 'auto'
     
              heights[x] = `${that.div.clientHeight}px`
              that.div.style.height = '0px'
     
              timer[x] = setTimeout(function () {
                that.div.style.height = heights[x]
              }, 0)
            } else {
              that.bout.classList.add('disabled')
              that.div.style.height = '0px'
     
              that.div.addEventListener('transitionend', function () {
                that.div.classList.remove('active')
                that.bout.classList.remove('disabled')
                that.bout.innerText = 'Ouvrir le cadre...'
              }, {
                once: true
              })
            }
          }
        }
     
        document.querySelectorAll('.bouton').forEach((boutonSelect, index) => {
          boutonSelect.addEventListener('click', function (event) {
            event.preventDefault();
     
            let nprg = new prg(index)
            nprg.div = document.querySelectorAll('.dv')[index]
            nprg.bout = boutonSelect
            nprg.openClose(index)
          })
        })
     
        onresize = (event) => {
          for (let divs of document.querySelectorAll('.dv')) {
            divs.style.height = 'auto';
            divs.style.height = divs.clientHeight + 'px'
          }
        }
      </script>
     
    </body>
    </html>

    il a fallu supprimer ces lignes car le texte html dans les DIV était remplacé par le texte de la variable 'texte ='
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
       for (let baliseP of document.querySelectorAll('div > p')) {
          baliseP.innerHTML = texte
        }
    Merci beaucoup ASCIIDEFOND pour votre aide et votre disponibilité

  19. #19
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    97
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 97
    Points : 47
    Points
    47
    Par défaut
    dans la serie tu avances d'un pas tu recules de deux ...

    j'ai maintenant cette erreur
    <b>Notice</b>: Undefined variable: _that_i in <b>/home/dith1146/public_html/includes/fonctions_tpl.php(223) : eval()'d code</b> on line <b>186</b><br />
    <br />
    <b>Notice</b>: Undefined variable: _div_i in <b>/home/dith1146/public_html/includes/fonctions_tpl.php(223) : eval()'d code</b> on line <b>186</b><br />
    lorsque j'utilise le code Javascript sur mon site en construction...

    Il semble y avoir un conflit avec une fonction utilisée par le système de template que j'utilise (phpBB)

Discussions similaires

  1. Fermeture d'une div lisant une vidéo sous ie
    Par Madoka dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 10/07/2009, 12h17
  2. fermeture d'une pop-up SANS javascript
    Par sarah65536 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 21
    Dernier message: 18/05/2009, 14h15
  3. Réponses: 6
    Dernier message: 09/10/2008, 19h43
  4. Réponses: 2
    Dernier message: 30/09/2008, 14h18
  5. ouverture/fermeture d'une fenêtre modale showModelessDialog
    Par marti dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 04/01/2006, 05h03

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