Tuesday, 15 July 2014

CSS Message bog show automatically & hide

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<style type="text/css">
.message{ width: 90%; margin-left:auto; margin-right:auto; position: relative; top: 5px; }
</style>
<?php if(isset($_SESSION["e_msg"]) && $_SESSION["e_msg"]!=""){ ?>
<div class="alert alert-danger alert-error message" style='display:none;'>
   <a href="#" class="close" data-dismiss="alert">×</a>
   <strong>Error!</strong> <?php echo $_SESSION["e_msg"]; ?>
</div>
<script type='text/javascript'>
$( document ).ready(function() {    $(".alert-danger").fadeIn( "slow" );  });
setTimeout(function(){ $(".alert-danger").slideToggle( "slow" ); },3000);</script>
<?php
unset($_SESSION['e_msg']);
}
if(isset($_SESSION["i_msg"]) && $_SESSION["i_msg"]!=""){ ?>
<div class="alert alert-info message" style='display:none;'>
   <a href="#" class="close" data-dismiss="alert">×</a>
   <strong>Note!</strong> <?php echo $_SESSION["i_msg"]; ?>
</div>
<script type='text/javascript'>
$( document ).ready(function() {    $(".alert-info").fadeIn( "slow" );  });
setTimeout(function(){ $(".alert-info").slideToggle( "slow" ); },3000);</script>
<?php
unset($_SESSION['i_msg']);
}
if(isset($_SESSION["w_msg"]) && $_SESSION["w_msg"]!=""){ ?>
<div class="alert alert-warning warning message " style='display:none;'>
    <a href="#" class="close" data-dismiss="alert">×</a>
    <strong>Warning!</strong>  <?php echo $_SESSION["w_msg"]; ?>
</div>
<script type='text/javascript'>
$( document ).ready(function() {    $(".alert-warning").fadeIn( "slow" );  });
setTimeout(function(){ $(".alert-warning").slideToggle( "slow" ); },3000);</script>
<?php
unset($_SESSION['w_msg']);
}
if(isset($_SESSION["s_msg"]) && $_SESSION["s_msg"]!=""){ ?>

<div class="alert alert-success message" style='display:none;'>
   <a href="#" class="close" data-dismiss="alert">×</a>
   <strong>Success!</strong>  <?php echo $_SESSION["s_msg"]; ?>
</div>
<script type='text/javascript'>
$( document ).ready(function() {    $(".alert-success").fadeIn( "slow" );  });
setTimeout(function(){ $(".alert-success").slideToggle( "slow" ); },3000);</script>
<?php
unset($_SESSION['s_msg']);
}
?>

No comments:

Post a Comment