Reputation: 99
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>
Upvotes: 0
Views: 1138
Reputation: 3649
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;
}
Upvotes: 1