Coder Social home page Coder Social logo

Comments (13)

laymonk avatar laymonk commented on June 9, 2024

On your site, you have an additional issue: with the side-bar expanded, the scroll bar vanishes, and so you cannot scroll down in the displayed post.

At first I thought this might have had something to do with your switching layout to layout-reverse. But I just tested this on my local install, and that problem is not there.

So, I reckon this is to do with the ordering of your markup or something you have introduced .. the base lanyon config is not displaying this behaviour

from lanyon.

laymonk avatar laymonk commented on June 9, 2024

OK, using firebug light, what I can see is that your shifter-page div has enclosed the shifter-navigation div .. I suspect this is not what you are seeking to do. Try and seperate the two divs ..

Disclaimer: I have not looked thoroughly through the rest of the setup, so I could be wide off the mark.

from lanyon.

hkalant avatar hkalant commented on June 9, 2024

You are off topic I guess for two reasons:

  1. You are not making a suggestion on my issue (how to click on the white space and hide the sidebar)
  2. benplum.com is not my website. It is just an example I found of what I would like to do, not how I would like to do it.

For the record this is my blog: http://hkalant.github.io/

Thanks.

from lanyon.

laymonk avatar laymonk commented on June 9, 2024

OK .. it was not clear from your post.

was just trying to offer what I thought was useful input .. the site you
want to emulate is broken though and what you think is a feature is
probably a result of that.

On 8 June 2014 00:46, Harry Kalantzis [email protected] wrote:

You are off topic I guess for two reasons:

  1. You are not making a suggestion on my issue (how to click on the
    white space and hide the sidebar)
  2. benplum.com is not my website. It is just an example I found of
    what I would like to do, not how I would like to do it.

For the record this is my blog: http://hkalant.github.io/

Thanks.


Reply to this email directly or view it on GitHub
#42 (comment).

from lanyon.

hkalant avatar hkalant commented on June 9, 2024

Let's see another more popular website: https://medium.com/
which was built by great designers and developers.

When the sidebar is expanded (click the 'M' icon), the scroll bar vanishes as well. It's hard believe this is a bug. Because when the sidebar is being expanded, it pushes the scroll bar, which is actually a part of the website, not a built-in browser addition.

Anyway, I don't really care if the scroll-bar vanishes. I just want to click anywhere on the site to hide the sidebar. That's all.

Thanks.

from lanyon.

laymonk avatar laymonk commented on June 9, 2024

Yeah, I have understood what you mean. The intention seems to just be to
expand the side-bar primarily to be able to make a navigation choice and
nothing else ..

If you are determined to understand how this is implemented, tools like
firebug/firebug-lite will help you quickly figure it out.

The feature that actually allows the ability to do this is a new CSS3
feature called transition, and it seems fairly straight-forward to .. the
more challenging thing is getting that to play nice with the rest of your
site's layout, and firebug can help you see how a given site is using it
(at least you get a clear view of the site structure) and can base your own
design or adjustments on that

On 8 June 2014 13:07, Harry Kalantzis [email protected] wrote:

Let's see another more popular website: https://medium.com/
which was built by great designers and developers.

When the sidebar is expanded (click the 'M' icon), the scroll bar vanishes
as well. It's hard believe this is a bug. Because when the sidebar is being
expanded, it pushes the scroll bar, which is actually a part of the
website, not a built-in browser addition.

Anyway, I don't really care if the scroll-bar vanishes. I just want to
click anywhere on the site to hide the sidebar. That's all.

Thanks.


Reply to this email directly or view it on GitHub
#42 (comment).

from lanyon.

hnrch02 avatar hnrch02 commented on June 9, 2024

If you don't care too much about mobile, you can use this snippet:

var $checkbox = $('#sidebar-checkbox');

$(document).on('click', function(e) {
  var $target = $(e.target);

  if(!$checkbox.prop('checked') ||
     $target.closest('#sidebar').length ||
     $target.is('#sidebar-checkbox, .sidebar-toggle')) return;

  $checkbox.prop('checked', false);
});

If you want this to properly work on mobile you'll need to insert a backdrop and then listen for touchstarts on that element. See for instance the implementation in Bootstrap.

from lanyon.

mdo avatar mdo commented on June 9, 2024

Yeah, I don't know if I'll be adding anything to account for negative space clicks. This is meant to be as simple as possible, using only HTML and CSS. As such, this kind of behavior is intentional and purposefully limiting.

from lanyon.

mdo avatar mdo commented on June 9, 2024

I'd be open to adding a non-jQuery snippet of JS to the code to make this possible, if it's not too much overhead mind you.

from lanyon.

hkalant avatar hkalant commented on June 9, 2024

that would be great. thanks.

from lanyon.

hnrch02 avatar hnrch02 commented on June 9, 2024

Here you go:

(function(document) {
  var toggle = document.querySelector('.sidebar-toggle');
  var sidebar = document.querySelector('#sidebar');
  var checkbox = document.querySelector('#sidebar-checkbox');

  document.addEventListener('click', function(e) {
    var target = e.target;

    if(!checkbox.checked ||
       sidebar.contains(target) ||
       (target === checkbox || target === toggle)) return;

    checkbox.checked = false;
  }, false);
})(document);

This should work everywhere, except IE < 9

(FYI: I used jQuery in my previous snippet, because I saw that @hkalant's site already uses jQuery.)

from lanyon.

hnrch02 avatar hnrch02 commented on June 9, 2024

@mdo Ping.

from lanyon.

mdo avatar mdo commented on June 9, 2024

Oh snap.

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.