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 :

Responsive image dans un slider


Sujet :

Responsive design en CSS

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Septembre 2011
    Messages
    81
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Septembre 2011
    Messages : 81
    Par défaut Responsive image dans un slider
    Bonjour,

    Cela fait quelques jours que j'essai de d'obtenir un slider responsive.

    Je n'arrive pas à ce que les images s'adaptent automatiquement au cadre de mon slider. Les images qui sont trop grandes ne se rétrécissent pas par exemple.

    Puis j'aimerai que lorsque la fenêtre d'internet est redimensionnée, que mon slider le soit aussi.

    J'ai essayé beaucoup de chose sans succès...

    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
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <link rel="stylesheet" type="text/css" href="../portfolio/css/content.css" />
    <link rel="stylesheet" href="../portfolio/css/threeSixty.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="../portfolio/css/swipebox.css">
     
    </head>
     
    <body>
     
    <div id="content-container">
     
    <div class="touchslider-in">
    <div class="touchslider-in-in">
     
    <div class="touchslider">
    <div class="touchslider-nav"><a class="touchslider-prev"><span class="touchslider-prev-in"><</span></a><a class="touchslider-next"><span class="touchslider-next-in">></span></a></div>
    <div class="touchslider-viewport"><div style="width:100%">
     
    <div class="touchslider-item"><a href="../portfolio/dock/dock1.jpg" class="swipebox" title="iPhone5 Dock"><img class="touchslider-image" src="../portfolio/dock/dock1.jpg"></a></div>
    <div class="touchslider-item"><a href="../portfolio/dock/dock2.jpg" class="swipebox" title="iPhone5 Dock"><img class="touchslider-image" src="../portfolio/dock/dock2.jpg"></a></div>
    <div class="touchslider-item"><a href="../portfolio/dock/dock3.jpg" class="swipebox" title="iPhone5 Dock"><img class="touchslider-image" src="../portfolio/dock/dock3.jpg"></a></div>
    <div class="touchslider-item"><a href="../portfolio/dock/dock4.jpg" class="swipebox" title="iPhone5 Dock"><img class="touchslider-image" src="../portfolio/dock/dock4.jpg">&nbsp;</a></div>
     
    </div>
    </div>
     
    <div class="touchslider-nav"><a class="touchslider-nav-item touchslider-nav-item-current"></a><a class="touchslider-nav-item"></a><a class="touchslider-nav-item"></a><a class="touchslider-nav-item"></a></a>
    </div>
     
    </div>
    </div>
    </div>
     
     
    <div id="content2">
    <div class="title">UltraSlim case for iPhone 5</div>
    <div class="description">
    Case for the iPhone 5. This case allows a protection of the sides and the back of the case.
    Features :<br><br>
    - Only 0.5mm wall thickness<br>
    - Full access to connectors<br>
    - Protection of the polished sides and back in aluminium<br>
    - Fully transparent<br><br>
    If you need further information, please don't hesitate to contact me.
    Case for the iPhone 5. This case allows a protection of the sides and the back of the case.
    Features :<br><br>
    - Only 0.5mm wall thickness<br>
    - Full access to connectors<br>
    - Protection of the polished sides and back in aluminium<br>
    - Fully transparent<br>
    If you need further information, please don't hesitate to contact me.
    </div>
    <div class="overlay"></div>
    </div>
    </div>
     
    </body>
     
     
     
    <script src="../portfolio/js/jquery.touchslider.js"></script>
    <script>
            $(".touchslider").touchSlider({mouseTouch: true});
    </script>
     
    <script src="../portfolio/js/jquery.swipebox.min.js"></script>
    <script type="text/javascript">
                    jQuery(function($) {
                            $(".swipebox").swipebox();
                    });
    </script>
     
    <!--<script src="../portfolio/js/prototype.js" type="text/javascript" charset="utf-8"></script>
    <script src="../portfolio/js/browserdetect.js" type="text/javascript" charset="utf-8"></script>
    <script src="../portfolio/js/vr.js" type="text/javascript" charset="utf-8"></script>
    <script src="../portfolio/dock/js/threesixty.js" type="text/javascript" charset="utf-8"></script>-->
     
    </html>


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    html, body {
      position : relative;
      margin: 0;
      padding: 0;
    }
    #content-container {
      position: relative;
      display: inline-block;
      min-width: 768px;
      max-width: 1280px;
      min-height: 100%;
      height: auto;
    }
     
    #image-content {
      position : relative;
      top: 48px;
      width: 100%;
      text-align: center;
    }
    #image-content img {
      width: 500px;
     
    }
    #content1 {
      position: relative;
      float: left;
      margin: 0 auto;
      padding: 0 auto;
      width: 50%;
      height: 100%;
    }
    #content2 {
      position: relative;
      float: right;
      right: 0;
      width: 50%;
      max-height: 100%;
      height: auto;
      margin: 0;
      padding: 0;
      text-align:left;
      overflow-y:hidden;
      overflow-x:hidden;
      background: rgba(0,0,0,0.7);
      -webkit-box-shadow: 0px 0px 12px rgba(0,0,0,0.5);
      -moz-box-shadow: 0px 0px 12px rgba(0,0,0,0.5);
      box-shadow: 0px 0px 12px rgba(0,0,0,0.5);
    }
    .title {
      position: relative;
      font-family: 'confortaa-light';
      font-size: 18px;
      font-weight: normal;
      color: rgb(69,185,246);
      margin:0;
      padding-top: 15px;
      padding-bottom: 15px;
      padding-left: 20px;
    }
    .description {
      position: relative;
      font-family: 'confortaa-light';
      font-size: 14px;
      font-weight: normal;
      color: #fff;
      padding-left: 35px;
      padding-right: 20px;
      padding-bottom: 15px;
     
    }
    /* Let's get this party started */
    ::-webkit-scrollbar {
    	margin-top: 10px;
    	margin-bottom: 10px;
    	right: 10px;
        width: 5px;
    }
     
    /* Track */
    ::-webkit-scrollbar-track {
        -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
        -webkit-border-radius: 10px;
    	margin-top: 10px;
    	margin-bottom: 10px;
        border-radius: 3px;
    }
     
    /* Handle */
    ::-webkit-scrollbar-thumb {
        -webkit-border-radius: 10px;
        border-radius: 3px;
        background: rgb(85,85,85); 
        -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
    }
    ::-webkit-scrollbar-thumb:window-inactive {
    	background: rgb(85,85,85); 
    }
     
    /* Touch slider */
    .touchslider-in { 
    	max-width: 50% ;
    	height: auto;
    	box-sizing: border-box;
    	float: left;
    	margin-top: -50px;
    }
    .touchslider-in-in { 
    	margin-top: 0;
    	margin-left: 40px;
    	margin-right: 40px;
    	box-sizing: border-box;
    }
    .touchslider {
    	position:relative;
    	height:auto;
    	width: 100% ;
    }
     
    .touchslider-viewport {
    	position:relative;
    	overflow:hidden;
    	width:500px;
    	max-height:375px;
    	max-width: 100% ;
    	box-sizing: border-box;
    	border: 5px solid rgba(0,0,0,0.8);
    	background: rgba(0,0,0,0.8);
    	-webkit-box-shadow: 0px 0px 12px rgba(0,0,0,0.5);
    	-moz-box-shadow: 0px 0px 12px rgba(0,0,0,0.5);
    	box-shadow: 0px 0px 12px rgba(0,0,0,0.5);
    }
    .touchslider .touchslider-item {
    	overflow: hidden;
    }
    img.touchslider-image{
    	height: auto;
    	max-width:500px;
        display:block;
    }
    .touchslider .touchslider-nav {
    	text-align: center;
    	font-weight: bold;
     
    }
    .touchslider .touchslider-nav a {
    	cursor: pointer;
    	font-family: 'confortaa-light';
    	font-size: 40px;
    	color: #000; 
    	font-weight: bold;
    	text-align: center;
    }
    .touchslider .touchslider-nav a:hover{
    	color: rgb(69,185,246);
    }
    .touchslider-nav {
    	color: color; 
    	font-weight: bold;
    	text-align: center;
    }
    .touchslider .touchslider-prev {
    	position: relative;
    	z-index: 999999;
    	float: left;
    	text-align: right;
    	height: 60px;
    	width: 30px;
    	top: 200px;
    	left: -40px;
    }
    .touchslider .touchslider-next {
    	position: relative;
    	float: right;
    	text-align: left;
    	height: 60px;
    	width: 30px;
    	top: 200px;
    	right: -40px;
    }
    .touchslider .touchslider-next-in {
    	position: absolute; /* fix safari render font */
    	right: 10px;
    }
    .touchslider .touchslider-prev-in {
    	position: absolute;
    	left: 10px;
    }
    .touchslider .touchslider-nav-item {
    	width: 5px;
    	height: 5px;
    	background: #fff;
    	margin-right: 5px;
    	margin-left: 5px;
    	margin-bottom: 2px;
    	display: inline-block;
    	-webkit-border-radius: 12px;
    	border-radius: 12px;
    	-webkit-box-shadow: 0px 0px 5px rgba(0,0,0,0.5);
    	-moz-box-shadow: 0px 0px 5px rgba(0,0,0,0.5);
    	box-shadow: 0px 0px 5px rgba(0,0,0,0.5);
    }
    .touchslider .touchslider-nav-item-current {
    	background: rgb(69,185,246);
    }
    voici une démo : http://fiddle.jshell.net/nQH7N/

    En espérant que l'on puisse m'aider!!

    Merci d'avance!

    EDIT: dans la démo l'image semble prendre une bonne taille. Cependant, intégré dans mon site, le slider à une hauteur presque nulle....

  2. #2
    Membre Expert
    Avatar de rodolphebrd
    Homme Profil pro
    Indépendant
    Inscrit en
    Novembre 2012
    Messages
    2 336
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Indépendant
    Secteur : Conseil

    Informations forums :
    Inscription : Novembre 2012
    Messages : 2 336
    Par défaut
    En terme de slider responsive je suis tombé sur celui-ci: royal slider, une véritable tuerie.
    Du coup maintenant je ne me casse plus la tête.

Discussions similaires

  1. Ajout image dans slider html Css
    Par nogir dans le forum Mise en page CSS
    Réponses: 2
    Dernier message: 28/04/2015, 12h15
  2. [CSS 3] Centrage d'une image dans un slider parallax
    Par BobLornac dans le forum Mise en page CSS
    Réponses: 0
    Dernier message: 19/11/2014, 11h13
  3. Problème d'affichage d'image dans un slider Jquery
    Par azrael62 dans le forum Mise en page CSS
    Réponses: 3
    Dernier message: 17/07/2012, 10h24
  4. Réponses: 6
    Dernier message: 30/12/2011, 09h35
  5. [VB6] [Excel] Insérer une image dans une feuille
    Par mathias dans le forum VB 6 et antérieur
    Réponses: 7
    Dernier message: 09/10/2002, 07h44

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