Je vais essayer d’expliquer en détail ce que je veux, car il est difficile d’expliquer comment je le souhaite. J’ai créé un site web responsive, où je veux montrer 3 boîtes:
(Jour 1 – Jour 2 – Jour 3)
Voir l’image que je veux regarder
Le problème (essayez ceci et vous verrez quel est mon problème:
La raison pour laquelle j’ai créé le redimensionnement, était pour le bureau, donc il développait toutes les cases vus sur le bureau.
MON CODE:
$(document).ready(function() { if($(window).width()436) $('.bbottom, .bbottom2').show(); else $('.bbottom2').hide(); });
.ticket{ margin:0; padding:0; float:left; } .btop2, .btop{ background-color:grey; color:white; padding:5px 10px; display:block; width:100px; border-bottom:1px solid; pointer-events:none; } .btop:hover{ background-color:darkgrey; } /*Responsive*/ @media screen and (max-width: 436px) { .ticket{ margin:0; padding:0; float:none; } .btop{ background-color:red; pointer-events:auto; } .btop:hover{ cursor:pointer; } }
Day 1 Price 20 Day 2 Price 99 Day 3 Price 149
Ajoutez simplement $menuItem.toggleClass( "bbottom2" );
sur le bouton .btop
et append également la classe bbottom
à un autre ticket
$(document).ready(function() { if($(window).width()<436) $('.bbottom2').hide(); $('.btop').click(function(e) { e.preventDefault(); var $menuItem = $(this).next('.bbottom, .bbottom2'); $menuItem.slideToggle(); $menuItem.toggleClass( "bbottom2" ); }); }); $( window ).resize(function() { if($(window).width()>436) $('.bbottom, .bbottom2').show(); else $('.bbottom2').hide(); });
.ticket{ margin:0; padding:0; float:left; } .btop2, .btop{ background-color:grey; color:white; padding:5px 10px; display:block; width:100px; border-bottom:1px solid; pointer-events:none; } .btop:hover{ background-color:darkgrey; } /*Responsive*/ @media screen and (max-width: 436px) { .ticket{ margin:0; padding:0; float:none; } .btop{ background-color:red; pointer-events:auto; } .btop:hover{ cursor:pointer; } }
Day 1 Price 20 Day 2 Price 99 Day 3 Price 149