Jump to content

Navbar Similar To This One


friedice

Recommended Posts

im tryin to create a navbar similar to the one on here well mostly other websites too

when u log on on the site

for example when u click on the username a popdown windows shows up

 

i got the the div to show up including user information/

only problem is that the top part in the navbar doesnt change proper

here its black background.. when u hover its grey background .. when u click it, it turns white

i tried using just normal onmouseover and on mouseout

and

using image changes for it but when its mouse over it goes back to default black image

 

<div id="header">

  <a id="accountgear" href="javascript:toggle()"><img src="images/navigation/gear_icon_white_40x40.png"
  onmouseover="this.style.backgroundColor='#444444'" onmouseout="this.style.backgroundColor=''"/></a>

 </div>

 

when clicked it calls the js to the show the div containin the info

 

function toggle() {
 var ele = document.getElementById("accountgear");
 var text = document.getElementById("accountsettings");
 document.getElementById("accountsettings").style.display = "block";
   $('#header').css({ 'opacity': 1 });
 $('#accountsettings').css({ 'opacity': 1 });
 $('#scroller').css({ 'opacity': 0.5 });
 $('#maincontent').css({ 'opacity': 0.5 });

}

  function monitorClick(e){
    var evt = (e)?e:event;

    var theElem = (evt.srcElement)?evt.srcElement:evt.target;
    while(theElem!=null){
	  if(theElem.id == "accountsettings" || theElem.id == "clickclick" && document.getElementById('accountsettings').style.display == 'none') {
	  document.getElementById('accountsettings').style.display = 'block';
	  return true;
	  }

	  theElem = theElem.offsetParent;		
    }
    document.getElementById('accountsettings').style.display = 'none';
  $('#scroller').css({ 'opacity': 1});
    return true;
  }
  document.onclick = monitorClick;

 

accountsettings div is in the next div after the header

thanks

Link to comment
https://forums.phpfreaks.com/topic/268907-navbar-similar-to-this-one/
Share on other sites

anyone?

 

or a clue on goin bout this?

 

You haven't identified a problem. There are several approaches to this sort of thing, so instead of waiting for somebody to rewrite or copy and test your code, why don't you suggest where we can help you. (And this time, please use punctuation properly so we can understand.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.