Today I am going to show you how you can create a cool progress indicator to tell your end user that something is going on behind the back of an action. Below is an image of the progress indicator that slides from the top to the middle of the screen then displays the processing message then slides up and disappears once done. This code does not use any other 3rd party jquery plugin to display progress indicator.
<html> <head> <script src="scripts/jquery.js"></script> <script type="text/javascript" > var $j = jQuery.noConflict(); $j(document).ready(function(){ $j("#btnSubmit").click(function(){ $j("#messenger").css("width", document.body.offsetWidth); $j("#messenger").css("height", document.body.offsetHeight); $j("#messenger").css("opacity",.7); $j("#messenger").fadeIn('fast'); $j("#messengermessage").css("width", document.body.offsetWidth); $j("#messengermessage").animate({opacity: "1", top: "+=" + addToAnimation, height: "100", width: document.body.offsetWidth}, "slow") var myhtml = '<div style="float:left; position:relative; padding-top:30px;"><img src="images/processing.gif" /></div><div style="float:left; position:relative; padding-top:40px;"><font style="font-family:verdana; font-size:14px;color:#000000; font-weight:bold;">saving attachments...</font></div>' $j("#messengermessage").html(""); $j("#messengermessage").html(myhtml); $j.post('handlers/EmployeeRequisition.ashx', { requestedBy : GetRequestedBy(), requestor : GetRequestor(), requisitionDate : $j("#dtpRequisitionDate").val() }, function(data) { myhtml = '<div style="float:left; position:relative; padding-top:30px;"><img src="images/processing.gif" /></div><div style="float:left; position:relative; padding-top:40px;"><font style="font-family:verdana; font-size:14px;color:#000000; font-weight:bold;">form saved... </font></div>' $j("#messengermessage").html(""); $j("#messengermessage").html(myhtml); $j("#messengermessage").animate({opacity: "1"},2000, function(res) { var subtractThis = document.body.offsetHeight - 500; $j("#messengermessage").animate({opacity: "0", top: "-=" + subtractThis, height: "0", width: document.body.offsetWidth}, "slow") $j("#messenger").fadeOut('fast'); }); }); }); </script> </head> <body style="font-family: Verdana; margin: 0px;"> <form id="frmHR001" runat="server"> <div> ............ </div> <div> <input type="button" id="btnSubmit" value="submit" /> </div> <div id="messenger" style="float: none; position: absolute; width: 100%; height: 100%; background-color: #000000; display: none; left: 0; top: 0;"> </div> <div id="messengermessage" style="float: none; position: absolute; width: 100%; height: 100px; background-color: #ffffff; display: none; left: 0; top: 0; text-align: center;"> <div style="float: left; position: relative; padding-top: 30px;"> <img src="images/processing.gif" /> </div> <div style="float: left; position: relative; padding-top: 40px;"> <font style="font-family: Verdana; font-size: 14px; color: #000000; font-weight: bold;"> processing...</font> </div> </div> </form> </body> </html> The code is quite long but then again it achieves our purpose. Let me know if there are any issues implementing this code. Cheers, Ujjwal Soni
3 comments:
Amazing stuff,Thanks so much for this!
___________
diablo 3 gold | diablo 3 guide
Panda Elijah the rarest Ruishou - Herd take home. According to legend Herd will bring harmony and good luck, foot silver white clouds, flight speed increase as your riding skill level. Buy Herd you buy the horse World of Warcraft game account, all existing and future created role will have a dazzling auspicious mounts. Do you want the rewards that can not be exchanged by the world of warcraft gold? Do you want the mount that stands for the highest reputation? Do you want the mount that will bring you endless of glory? Now is the time. Seize your time to get the best wow rewards.
Panda Elijah the rarest Ruishou - Herd take home. According to legend Herd will bring harmony and good luck, foot silver white clouds, flight speed increase as your riding skill level. Buy Herd you buy the horse World of Warcraft game account, all existing and future created role will have a dazzling auspicious mounts. Do you want the rewards that can not be exchanged by the world of warcraft gold? Do you want the mount that stands for the highest reputation? Do you want the mount that will bring you endless of glory? Now is the time. Seize your time to get the best wow rewards.
Post a Comment