Premier clic: vide floatymessage div. deuxième clic et après: fonctionne.jQuery: div n'apparaît pas avant le deuxième clic? Je le veux sur le premier. =
jQuery:
function floatymessage(message){
var box = $j(".floatymessage")
if (box.length == 0) {
$j('body').append("<div class='floatymessage'></div>");
}
box.html(message);
// center it
box.css("left", ($j(window).width() - box.width())/2+$j(window).scrollLeft() + "px");
box.fadeIn('slow');
setTimeout(function(){$j('.floatymessage').fadeOut('slow');},3500);
}
lien:
<a href="#" onclick="floatymessage('Asking questions is not allowed.');"></a>
pour floatymessoge css:
div.floatymessage {
position: absolute;
top: 20%;
width: 300px;
height: 50px;
background: black;
color: white;
text-align: center;
filter:alpha(opacity=75);
-moz-opacity:0.75;
-khtml-opacity: 0.75;
opacity: 0.75;
box-shadow: 10px 10px 5px #000;
border: 1px solid black;
border-bottom-left-radius: 5px 5px;
border-bottom-right-radius: 5px 5px;
border-top-left-radius: 5px 5px;
border-top-right-radius: 5px 5px;
line-height: 50px;
z-index: 10000;
display: none;
}
ce qui est ce 'j' fait entre votre '$' et '(' En outre, qu'est-ce que le regard CSS comme pour 'floatymessage' – Hristo
@Hristo -? DerNalia fonctionne en' .noConflict() ' mode http://api.jquery.com/jQuery.noConflict/ – user113716
@patrick dw, yep @hristo: posté mon css – NullVoxPopuli