bind() et mouseover: Est-ce conciliable ?
Bonjour,
Je viens de découvrir les fonctions "bind()" et "unbind()" de jquery et j'aurais aimé pouvoir les utiliser avec des évènements comme mouseover (ou mouseenter...), ceci afin de me permettre d'éviter l'effet de "rebondissement intempestif" quand on survole plusieurs fois de suite l'image [+] (voir code ci-dessous), or, à la base, ces évènements là, à la différence de "click"...) ne sont pas prévus pour cette fonction ! :(
:fleche: Existerait-il une extension (style jquery UI ou...) qui permettrait ce genre d'association ?
Ps: Dans le code de cette page (section du site de jQuery UI), on trouve:
Code:
$(this).bind("mouseover", jQuery.event.special.hoverintent.handler);
Ce qui me laisse à entendre que cela serait donc possible (?), mais, si c'est le cas, comment faire, SVP ? Faut-il charger la bibliothèque jQuery UI ? ou seulement une partie ? Et si oui, comment faire pour rendre mon code jQuery actuel "compatible" avec celui de cette extension (jQuery UI...) ?
Par avance Merci pour toute suggestion qui pourrait m'aider à avancer ! :)
Mon code actuel (J'ai bien essayé d'intégrer l'accés au module de jQuery UI mais... ça ne marche toujours pas !):
Code:
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
| <html>
<head>
<title>Empecher un rebond++ (jQuery)</title>
<style type="text/css">
#Container
{
z-index: 1;
border: 1px solid #F9CB66;
}
#Sous_titre
{
float: left;
height: 20px;
background-image: url("images/Degrade_sous_titre.png");
background-repeat: repeat-x;
padding: 0px;
margin: 0px;
text-align: left;
line-height: 18px;
text-indent: 15px;
color: #9E352F; /* Texte en rouge */
font-weight: bold; /* Texte en gras */
font-size: 13px;
font-family: Arial, "Arial Black", "Times New Roman", Times, serif;
}
#Ombre_sous_titre_d
{
float: left;
background-color: #663D1D;
width:5px;
height:17px;
margin-top: 3px; /* Décalage de l'ombre */
}
#Bouton_plus
{
float: left;
width: 20px;
height: 19px;
background-color: #FFD9B3;
background-position : right; /* Fond avec bouton "Plus" positionné à droite */
background-repeat: no-repeat;
}
#Bouton_moins
{
float: left;
width: 20px;
height: 19px;
background-color: #FFD9B3;
background-position : right; /* Fond avec bouton "Etoile" positionné à droite */
background-repeat: no-repeat;
}
#Texte
{
float: left;
height: 19px;
background-image: url("images/Fond_texte.png");
background-repeat: repeat-x;
text-align: left;
line-height: 17px;
text-indent: 1px;
color: black;
font-weight: normal;
font-size: 12px;
font-family: Arial, "Arial Black", "Times New Roman", Times, serif;
}
#Ombre_ligne_d
{
float: left;
background-color: #663D1D;
width:5px;
height:19px;
}
#Texte_caché
{
float: left;
background-color: #FFE9D2;
background-image: url("images/Ombre_ligne_droit.png");
background-position : right; /* Fond avec ombre positionnée à droite */
background-repeat: repeat-y;
text-align: left;
padding-left: 5px;
padding-right: 10px;
line-height: 17px;
text-indent: 7px;
color: black;
font-weight: normal;
font-size: 12px;
font-family: Arial, "Arial Black", "Times New Roman", Times, serif;
}
</style>
<link type="text/css" href="jquery-ui-1.8.custom/css/smoothness/jquery-ui-1.8.custom.css" rel="stylesheet" />
<script type="text/javascript" src="jquery-ui-1.8.custom/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.custom/js/jquery-ui-1.8.custom.min.js"></script>
</head>
<body bgcolor="#FFFFFF" background="images/Fond.png">
<div id="Container" style="position:absolute; width:320px; height:100px; left: 200px; top: 10px">
<div id="Sous_titre" style="width:300">Sous titre</div>
<div id="Ombre_sous_titre_d"></div>
<img id='Bouton_plus' src="images/Plus_mini_2.gif" border=0
onmouseover="$(function()
{
$(this).unbind('mouseover')
$('#Texte_caché').animate({
height : 'show'
},900)
})"
onmouseout="$(function()
{
$('#Texte_caché').animate({
height : 'hide'
},900)
})"
>
</img>
<div id="Texte" style="width:280px">Texte</div>
<div id="Ombre_ligne_d"></div>
<span class="message_numero1">
<!-- Gestion / texte caché -->
<div id="Texte_caché" style="display:none; width:290px">
<span>Texte qui apparait... Texte qui apparait... Texte qui apparait... Texte qui apparait... </span>
<br /><br />
</div>
</span>
</div>
</body>
</html> |