Giter Site home page Giter Site logo

Comments (3)

matiassingers avatar matiassingers commented on July 19, 2024

@sc0ttwad3 hope I understood your question correctly:

The sidebar is hidden/shown by clicking the hamburger icon, what the hamburger icon actually does is simply check a checkbox like you wrote. Going back in the browser will keep the checkbox checked in most modern browsers.

If you want to close the menu upon clicking a link you might want to do something like this in JS for toggling the open/closed state of the checkbox/sidebar:

var element = document.getElementById('sidebar-checkbox');
// toggling the open/close state
element.checked = !element.checked;

// or simply closing the sidebar
element.checked = false;

from lanyon.

sc0ttwad3 avatar sc0ttwad3 commented on July 19, 2024

Thanks for the snippet, I actually ended up doing something very similar to
handle that -- albeit I over-engineered the problem -- and much prefer the
economy of your solution! I also modified/animated the hamburger icon by
adapting the method described here:
http://www.elijahmanor.com/css-animated-hamburger-icon/

Thx.

On Mon, Apr 21, 2014 at 11:50 PM, Matias Singers
[email protected]:

@sc0ttwad3 https://github.com/sc0ttwad3 hope I understood your question
correctly:

The sidebar is hidden/shown by clicking the hamburger icon, what the
hamburger icon actually does is simply check a checkbox like you wrote.
Going back in the browser will keep the checkbox checked in most modern
browsers.

If you want to close the menu upon clicking a link you might want to do
something like this in JS for toggling the open/closed state of the
checkbox/sidebar:

var element = document.getElementById('sidebar-checkbox');// toggling the open/close stateelement.checked = !element.checked;
// or simply closing the sidebarelement.checked = false;


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-41001432
.

from lanyon.

mdo avatar mdo commented on July 19, 2024

Yeah it's by design to work as-is. This should be a no-JS interaction to start.

from lanyon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.