LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2017, 07:41 PM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 464

Rep: Reputation: 37
Sliding HTML navigation menu


Hello,

I want to create a navigation menu on the left of my page which can slide or unhide by clicking a button. Does anybody know how to do that?
 
Old 07-18-2017, 07:56 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,317
Blog Entries: 28

Rep: Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140
Check these two links:

https://www.w3schools.com/howto/howto_js_sidenav.asp

https://www.w3schools.com/howto/howt..._hide_show.asp

You may need to use a bit of javascript.
 
1 members found this post helpful.
Old 07-19-2017, 01:31 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,221

Rep: Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319
The usual pattern is to have a CSS class that determines whether the menu is hidden. You have Javascript, activated on a click of the button, that adds or remove that CSS class from the menu. For the animation, you use a CSS transition.

Last edited by dugan; 07-19-2017 at 08:56 PM.
 
1 members found this post helpful.
Old 07-21-2017, 01:30 AM   #4
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,149

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
You never explore Bootstrap?

Or Jquery?
 
Old 07-21-2017, 04:05 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,306
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
Quote:
Originally Posted by dugan View Post
The usual pattern is to have a CSS class that determines whether the menu is hidden. You have Javascript, activated on a click of the button, that adds or remove that CSS class from the menu. For the animation, you use a CSS transition.
Actually you can even do it in pure CSS, but for the nice effects you have to look through CSS3. The documentation for that is a little hard to navigate but worth it. That will help greatly with usability, maintenance, and security.

However, there are a lot of choices.

manolakis, can you point to some examples or clarify your written description a little more? It will be easier to point to more precise examples.
 
Old 07-21-2017, 04:24 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,306
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
Here's an example for CSS toggle that expands underneath. You can play around with it have it expand to the side instead, if that is what you want. You might even be able to set it to trigger on CSS rollovers.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <title>CSS Toggle</title>
  <style type="text/css" media="screen">
    summary {
    display: block;
    }
    
    summary::-webkit-details-marker {
    display: none;
    }
    
    summary:: {
    display: none;
    }
    
    summary::before {
    content: '\25B6';
    padding-right: 0.5em;
    }
    
    details[open] > summary::before {
    content: '\25BC';
    }
  </style>
  </head>
  <body>
  <p>Hello World</p>

  <details>
    <summary>Hide / Unhide</summary>
    <p>Now you see it.</p>
  </details>
</body>
</html>
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML website navigation structure help Daravon Linux - Newbie 3 07-21-2015 11:35 AM
folder navigation menu for linux ? dEnDrOn Linux - General 4 01-02-2013 06:35 AM
adding run command to Avant Navigation Bar and to Gnome Main Menu metallica1973 Linux - General 4 03-04-2010 02:58 PM
K Menu - calling html/webpage file from menu sKAApGIF Linux - Desktop 2 08-24-2006 07:15 AM
html popup/second level navigation bar newuser455 General 5 03-10-2005 07:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration