Floating message | Banner for IE6 users using jquery

April 1, 2010 at 4:33 am Leave a comment

CSS
———————–
#message_box {
position: absolute;
top: 0; left: 0;
z-index: 10;
background:#ffc;
padding:5px;
border:1px solid #CCCCCC;
text-align:center;
font-weight:bold;
width:99%;
}

Script
———————-
<script type=”text/javascript” language=”javascript”>

$(document).ready(function()
{
//scroll the message box to the top offset of browser’s scrool bar
$(window).scroll(function()
{
$(‘#message_box’).animate({top:$(window).scrollTop()+”px” },{queue: false, duration: 350});
if($(window).scrollTop()==0){

$(‘#message_box’).animate({top:$(window).scrollTop()+80+”px” },{queue: false, duration: 350});
}
});
//when the close button at right corner of the message box is clicked
$(‘#close_message’).click(function()
{
//the messagebox gets scrool down with top property and gets hidden with zero opacity

$(‘#message_box’).animate({ top:”+=15px”,opacity:0 }, “slow”);
});
});
</script>

HTML
—————————

<body>
<div id=”message_box”><img id=”close_message” style=”float:right;cursor:pointer”  src=”12-em-cross.png” />The floating message goes here</div>
<div>

content goes here

</div>

</body>

Entry filed under: jquery. Tags: .

GOD wanted to play cricket, so Sachin was born z-index issue with IE7

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Flickr Photos

The firsts lights

Lago di Braies

Survivor Mode

More Photos

Blog Stats

  • 705,777 hits

%d bloggers like this: