Post by bai on Mar 14, 2018 13:52:15 GMT -8
Forum URL: clairplane.boards.net
Hello! I have a custom dropdown menu I obtained through the help of w3schools, which I've customized already. I was wondering if there's any way to get a notification bubble to display the corner of this dropdown menu icon, in addition to displaying beside the 'Admin CP' icon/text?
I tried to figure it out myself with the variable but it won't display right for regular notifs and I can't find the admin CP notifs.
here's my code
Hello! I have a custom dropdown menu I obtained through the help of w3schools, which I've customized already. I was wondering if there's any way to get a notification bubble to display the corner of this dropdown menu icon, in addition to displaying beside the 'Admin CP' icon/text?
I tried to figure it out myself with the variable but it won't display right for regular notifs and I can't find the admin CP notifs.
here's my code
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.dropbtn {
background-color: #ebebeb;
color: black;
padding: 10px;
font-size: 16px;
border: none;
cursor: pointer;
line-height: 30px;
text-decoration: none;
}
.dropbtn:hover, .dropbtn:focus {
background-color: #FFFFFF;
}
.dropdown {
position: relative;
display: inline-block;
text-decoration: none;
}
.dropdown-content {
display: none;
position: absolute;
right: 20%;
background-color: #f1f1f1;
min-width: 160px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
text-decoration: none;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
text-align: justify;
display: block;
}
.dropdown a:hover {background-color: #ddd}
.show {display:block;}
</style>
<body>
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn"><img src="http://storage.proboards.com/6896723/images/QQPSkdtanGzbbiNnUqtX.png" title="Options"></button>
<div id="myDropdown" class="dropdown-content">
<!-- <a href="http://toobusystreaming.boards.net/thread/18/tbs-guide-rules" style="text-decoration:none;"><img src="http://storage.proboards.com/6896723/images/ulsrAvkpUXNwpwosnQPb.png" title="Forum Rules"/> Forum Rules</a>-->
{if $[current_user.group.id] == "5"}
{else}
<!--<a href="http://toobusystreaming.boards.net/page/donate" style="text-decoration:none;"><img src="http://storage.proboards.com/6896723/images/mqakuEstRhZidYwYZEXi.png" title="Donate & Become a VIP"> Donate</a>-->{/if}
<a href="http://clairplane.boards.net/board/6/help-information" style="text-decoration:none;"><img src="http://storage.proboards.com/6896723/images/OCZzrFOfDhxcyjlphbvN.png" title="Help and Information"> Help</a>
<a href="http://clairplane.boards.net/search" style="text-decoration:none;"><img src="//storage.proboards.com/6914169/images/OhKqrnZJbzKIYtWSPWZJ.png" title="Search"/> Search</a>
<a href="http://clairplane.boards.net/user/$[current_user.id]/settings/themeChange" style="text-decoration:none;"><img src="http://storage.proboards.com/6914169/images/YBKjckQhbWqj0QPzFTEm.png" title="Change Theme"> Change Theme</a>
{if $[current_user.is_staff]}<a href="http://clairplane.boards.net/admin" style="text-decoration:none;"><img src="http://storage.proboards.com/6896723/images/ASUukEzJRmRPhHglO0aZ.png" title="Admin CP"/> Admin CP</a>{/if}
<a href="$[logout_link.href]" style="text-decoration:none;"><img src="http://storage.proboards.com/6896723/images/OEiNHpQ0XfOfveSIhNsN.png" title="Sign Out" class="logoutt"/> Sign Out</a>
</div>
</div>
<script>
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
</body>