Je ne sais pas d'un tel plug-in pour jQuery, mais écrire l'interface utilisateur est assez simple.
(Modifier: En fait, je pensais à un endroit où je pourrais utiliser cette fonctionnalité moi-même, je pourrais aussi bien écrire un plugin approprié basé sur cette semaine si j'ai le temps, et l'éditer ici. l'instant, voici ce que je ... Envoyé)
Tout ce que vous avez besoin est un couple de divs:
<div id="thebutton">Click me!</div>
<div id="thebox" style="display:none;">Content goes here</div>
Et certains jQuery:
<script type="text/javascript">
$(function() {
$('#thebutton')
.click(function() {
//Show/hide the box
$(this).toggleClass('activated');
$(this).hasClass('activated') ? $('#thebox').fadeIn() : $('#thebox').fadeOut();
})
.mouseenter(function() {
//If the button is .activated, cancel any delayed hide and display the box
$(this).addClass('hovering');
if ($(this).hasClass('activated')) {
$('#thebox').clearQueue().fadeIn();
}
})
.mouseleave(function() {
//Hide the box after 300 milliseconds (unless someone cancels the action)
$(this).removeClass('hovering');
$('#thebox').delay(300).fadeOut();
});
$('#thebox')
//When hovering onto the box, cancel any delayed hide operations
.mouseenter(function() { $(this).clearQueue(); })
//When hovering off from the box, wait for 300 milliseconds and hide the box (unless cancelled)
.mouseleave(function() { $(this).delay(300).fadeOut(); });
});
</script>
Le reste est à peu près juste CSS pour #thebutton, #thebox, .hovering et .activated.
est ici un regard spartiate je en écrivant ceci:.
<style type="text/css">
#thebutton { width: 100px; background-color: #eee; text-align: center; padding: 10px; cursor: pointer; }
#thebutton.activated { font-weight: bold; }
#thebutton.hovering { color: Blue; }
#thebox { background-color: #eee; position:relative; width: 300px; height: 200px; padding: 10px; top: 5px; display: none;}
</style>
Je n'ai pas vu ce type de contrôle n'importe où - pourriez-vous éditer votre message avec un lien vers un exemple? – jevakallio
mis à jour, merci! –