Floating Message Box

We can build a floating message box on fly in the browser depends on the scroll position of the window. This can be done using jquery simple few link code as seen below,

Here in the below code will fly message while on click  in submit button.Create a div tag, that going to become  a message box look on gly in the browser,

<div id=”message_box” ></div>

$(document).ready(function(){ 

$(‘#message_box’).css({visibility:’hidden’});

 $(window).scroll(function()
   {
       temp_sval=$(window).scrollTop();
    }
 );
 $(“.save_btn”).click(function(event){
  $(‘#message_box’).css({visibility:’visible’});
  $(“#message_box”).html(‘Settings Updated Sucessfully’); 
    $(‘#message_box’).animate({top:temp_sval+”px”,opacity:1 },{queue: false, duration: 350}); 
 setTimeout(function(){
  $(‘#message_box’).animate({ top:”+=15px”,opacity:0 }, “slow”);
 },1500);
 });

  
});

Advertisements

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

%d bloggers like this: