Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
150
rated 0 times [  156] [ 6]  / answers: 1 / hits: 29648  / 14 Years ago, thu, february 17, 2011, 12:00:00

I m having following Code in which this code executes when i click a anchor tag named msgup



    $(#msgup).bar({
color : '#1E90FF',
background_color : '#FFFFFF',
removebutton : false,
message : 'Your profile customization has been saved!',
time: 4000

});


But I want to do this thing automatically when page loads , so what is required to achieve such workflow?



Actually i m using jBar plugin to show stackoverflow type notifications at top of the page.


More From » jquery

 Answers
21

I have done this using following code



$(document).ready(function()
{

$(<div id='notify'></div>).prependTo('body').hide();
}


Style defined in header:



<style>
#notify{

position:fixed;
top: 21%;
left: 40%;
width: 20%;
height:4%;
text-align:center;
text-weight:bold;
font-size:20px;
background-color:YELLOW;
color:BLUE;
padding:3px;
z-index:9999;
}

</style>


and dynamically call this function using following echo statement in PHP



echo <script> setTimeout(function(){
$('#notify').html('Updated Successfully !').slideDown(2000);
},0);
</script>;

[#93698] Tuesday, February 15, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
billtreytonb

Total Points: 211
Total Questions: 104
Total Answers: 114

Location: Sudan
Member since Tue, Aug 3, 2021
3 Years ago
;