0

I have one menu option in that leave request is the menu it will display like notification if there will be any notification, so suppose when employee is raising the request for leave and only one employee has raised the request then it should display 1 notification if 2 employee will raise the request then it should increase 2 and now second thing after clicking on notification it should display first person leave request on the jsp page i am totally confused how to start this i have just start with small thing here is my code....please anyone help me and suggest me some logic and ideas..

  <style>

 .badge1 {
position:relative;
   }
    .badge1[data-badge]:after {
  content:attr(data-badge);
  position:absolute;
  top:-10px;
 right:-10px;
  font-size:.7em;
  background:green;
  color:white;
    width:18px;height:18px;
     text-align:center;
       line-height:18px;
     border-radius:50%;
   box-shadow:0 0 1px #333;
 }


</style>
 </head>
    <body>

      <br>
   <a href="" class="badge1" data-badge="27">Badge Notification Example</a>
   </body>
  </html>
1
  • If i start this kind of app, after create a page like above, add an onclick event to this href and decrease the number shown at data-badge one by one. You should define a variable and show it to data-badge{$notificationCount}. Commented Jul 7, 2014 at 14:03

1 Answer 1

1

Please try below code maybe it gives you an idea, i try to make a demo which i describe at my comment. Please place jquery.min.js file at your workspace.

notification.html

<html>
        <head>
            <script src="jquery.min.js"></script>
            <link rel="stylesheet" type="text/css" href="style.css">
        </head>
        <body>
        <form method="POST">
            <a href="" id="notification"  class="badge" data-badge="0">Badge Notification Example</a>
            <input id="submit" value="Push" class="submit" onclick="push();"  type="button"></input>
            <input id="submit" value="Pop" class="submit" onclick="pop();"  type="button"></input>
        </form>
       </body>
    <script>
        function push(){
            var notification=$("#notification").attr("data-badge");
            var counter =parseInt(notification,10);
            if(counter>9){
                alert("Notification list is full!");
                return;     
            }
            counter=counter+1;      
            $("#notification").attr("data-badge",counter);
        }
        function pop(){
            var notification=$("#notification").attr("data-badge");
            var counter=parseInt(notification,10);
            if(counter<1){
                alert("list is empty!");
                return;     
            }
            counter=counter-1;
            $("#notification").attr("data-badge",counter);
        } 
    </script>
     </html>

style.css

.badge{
    position:relative;
}
    .badge[data-badge]:after {
    content:attr(data-badge);
    position:absolute;
    top:-10px;
    right:-10px;
    font-size:.7em;
    background:green;
    color:white;
        width:18px;
    height:18px;
        text-align:center;
        line-height:18px;
        border-radius:50%;
    box-shadow:0 0 1px #333;
}
.submit{
    margin-top    : 20px;
        margin-right  : 10px;
        margin-bottom : 20px;
        margin-left   : 10px;
    font-size:100m;
    background:orange;
    color:green;
        width:150px;
    height:30px;
        text-align:center;          
}
Sign up to request clarification or add additional context in comments.

1 Comment

i will try i have to add many things like values from database and other things so i will work on it, it will take long tym..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.