Ich versuche, eine Nachricht vom Typ stackoverflow zu erstellen. Ich fand den Großteil des Codes, den ich von anderen Posts benötigte, hatte aber Probleme beim Schließen von Nachrichten, wenn mehrere Benachrichtigungen verwendet wurden. wenn das zweite Feld von 3 geschlossen war ideal, dann wäre es abklingen und das dritte Feld würde der zweite PlatzJquery-Meldungen für mehrere Meldungen
HTML
<div class="message" style="display: none;">
<span>Hey, This is my Message.</span>
<a href="#" class="close-notify">X</a>
</div>
<div class="message" style="display: none;">
<span>Hey, This is my Message.</span>
<a href="#" class="close-notify">X</a>
</div>
<div class="message" style="display: none;">
<span>Hey, This is my Message.</span>
<a href="#" class="close-notify">X</a>
</div>
CSS
div.message {
font-family:Arial,Helvetica,sans-serif;
float: left;
left:0px;
width:100%;
height:15px;
text-align:center;
font-weight:bold;
font-size:100%;
color:white;
padding:10px 0px 10px 0px;
background-color:#8E1609;
}
.message span {
text-align: center;
font-size:1.1em;
width: 95%;
float:left;
}
.close-notify {
white-space: nowrap;
top: 0px;
font-size:1.1em;
float:right;
margin-right:10px;
margin-top: -15px;
color:#fff;
text-decoration:none;
border:2px #fff solid;
padding-left: 6px;
padding-right: 6px;
}
JQuery
<script type="text/javascript">
$(document).ready(function() {
$(".message").fadeIn("slow");
$(".message a.close-notify").live('click', function() {
$(this).parent().fadeOut('fast', function() { $(this).parent().remove(); });
return false;
});
});
</script>
nehmen
Sie haben uns nicht gesagt, was die Probleme waren. – womp