Using the 'sidr' or 'meanmenu' styles at least, the issue persists. It's due to the presence of a vertical scroll bar, so the breakpoint is about 15px or so off (the width of the vertical scrollbar).

Here's the patch I used to fix 'sidr'.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

perennial.sky’s picture

In responsive_menus_simple.js

Change 132 line
In $(window).resize() function
remove this line -> windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

Add this line -> windowWidth = $(window).width();

jwjoshuawalker’s picture

Sure, so what I was originally taking into account was this:
http://www.w3schools.com/js/js_window.asp?output=print

I had briefly tested some things using code like this page is doing:
http://ryanve.com/lab/dimensions/

So taking that into consideration, along with:
http://jsperf.com/jq-width-vs-client-width/5
(Run the test) Results:
-----------------------------
jQuery.width()
43,769 Ops/sec
±1.86%
100% slower

versus:

javascript native selector & .clientWidth
15,881,736 Ops/sec
±0.83%
fastest

-----------------------------

What I'll do is remove the window.innerWidth altogether and leave .clientWidth as the primary.

It's also mentioned on the page showing all the widths that $(window).width() uses the same .clientWidth, but the latter is faster (a lot faster):

"jQuery(window).width() uses document.documentElement.clientWidth and is regarded as cross-browser compatible. Directly using .clientWidth is faster and equally compatible. "

jwjoshuawalker’s picture

Status: Active » Closed (fixed)

Responsive Menus 1.4 is out.
This issue is resolved with new release.

https://drupal.org/node/2151023

lgerndt’s picture

Issue summary: View changes
FileSize
2.4 KB

Using the 'sidr' mode at least, the issue persists. It's due to the presence of a vertical scroll bar, so the breakpoint is about 15px or so off (the width of the vertical scrollbar).

Here's the patch I used to fix this.

lgerndt’s picture

Issue summary: View changes
lgerndt’s picture

Here's the patch I used to fix 'meanmenu'. It patches jquery.meanmenu.js. Note that Drupal calls the minified one, jquery.meanmenu.min.js, so you'll have to do the minification yourself and commit the new minified file.

jwjoshuawalker’s picture

@lgerndt
Sorry, I meant to reply to the first patch you made. Have you tried with the -dev version of Responsive Menus?
It uses a different function which accounts for the vertical scroll bar (this was updated after the 1.5 release).

I need to do a 1.6 release but there are other things I want to get committed first.