Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Netscape Right Click Menu - Admin Staff - not disable

    Hi,

    I have a lot of administration functions that need to be used on a regular basis by my administrators. What I would like to do to make the site a little more interesting and easier to use is to make hot spots on the interface that my administrators can right click on *not text fields, images or stuff like that* and can alter the properties of, such as the following situation:

    Right click on a user in the user list and bring up a circular scrolling window to the right of the mouse cursor with all the user's details and settings and options to email, update stuff etc. The functions I could call using php/mysql and display with dhtml or something. It's the actual opening of a real dynamic right click menu that I am looking to achieve not disabling it or making a css styled box menu with hyperlinks - but a dynamic right click menu for certain hot spots with lots of functions that otherwise take ages precious moments to scroll through and use.

    Any ideas on this?

    Willing to put a few pennies towards someone's time on it if necessary, because it's something I've not seen before and can't seem to make myself.

    Many thanks ^_^ and lovely forum guys.

    Stealth

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    I've got this knocking about - I think another coder here posted it originally - if you just right-click you get the usual context menu but if you hold down the right mouse button, move your mouse down a couple of inches and then release, you get a "hidden" menu. You could probably adapt it to work with hotspots or whatever.

    Just copy 'n paste into the <head>, or save to a .js and call the file.

    Code:
    document.write("<style>");document.write(".expanded {position:absolute;padding:1px;font:Arial, Helvetica, sans-serif;font-size:11px;text-align:left;background-color:#D4D0C8;width:150px;border-left :2px solid #FFFFFF;border-top :2px solid #FFFFFF;border-right :2px solid #999999;border-bottom : 2px solid #999999;}");
    document.write("a.expanda {padding-left:15px;padding-right:15px;display:block;text-decoration:none;color:#000000;}");
    document.write("a.expanda:hover {background-color:#003366;color:#FFFFFF;}");
    document.write("</style>");
    document.write("<div style=\"display:none\" class=\"expanded\" id=\"altnav\">");
    document.write("<a href=\"http://www.news.com\" class=\"expanda\" id=\"navlink\"><div style='float:right;width:20px;text-align:left'>Ctrl+?</div>Option 1</a>");
    document.write("<a href=\"http://www.cnn.com\" class=\"expanda\" id=\"navlink\"><div style='float:right;width:20px;text-align:left'>Ctrl+?</div>Option 2</a>");
    document.write("</div>");
    document.oncontextmenu = null;
    document.onmousedown = doDown;
    document.onmouseup = doUp;
    var timerID = "null";
    var ly;
    var ny;
    var targ;
    function doDown(e)
    {
    clearTimeout(timerID);
    document.oncontextmenu = null;
    var rightclick;
    if (!e) e = window.event
    if (e.which) rightclick = (e.which == 3);
    else if (e.button) rightclick = (e.button == 2);
    try 
    {
    if (e.target) targ = e.target.getAttribute('id');
    else if (e.srcElement) targ = e.srcElement.getAttribute('id');
    if (targ != "navlink") {document.getElementById('altnav').style.display = 'none';}
    }
    catch(e)
    {
    document.getElementById('altnav').style.display = 'none';
    }
    if (rightclick != false)
    	{
    	ly = e.clientY;
    	}
    return false;
    }
    
    function doUp(e)
    {
    	var rightclick;
    	if (!e) e = window.event
    	if (e.which) rightclick = (e.which == 3);
    	else if (e.button) rightclick = (e.button == 2);
    	if (rightclick != false)
    	{
    if (!e) var e = window.event;
    ny=e.clientY;
    lytemp = ly+50;
    if (ny>lytemp)
    {
    document.getElementById('altnav').style.display = "block";
    document.getElementById('altnav').style.left = e.clientX + 2;
    document.getElementById('altnav').style.top = ly+2;
    window.status = "down menu";
    document.oncontextmenu = fakecontext;
    timerID = setTimeout("document.getElementById('altnav').style.display = 'none';", 5000);
    }
    }
    ly =  null;
    ny = null;
    }
    function fakecontext(){return false;};

  • #3
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up ahhh - that's sweet :D only one question left now :D

    That's brilliant

    The only question I've got now is - how do you make it with internal navigation and set a non-box shape?

    *thanks you for a quick reply with info *

    Thankyou ^_^

    Stealth


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •