[wp-trac] [WordPress Trac] #33143: Twenty Fifteen uses jQuery window.width() - which is not synced with used media queries

WordPress Trac noreply at wordpress.org
Tue Feb 9 14:15:10 UTC 2016


#33143: Twenty Fifteen uses jQuery window.width() - which is not synced with used
media queries
---------------------------+------------------------------
 Reporter:  th23           |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Bundled Theme  |     Version:  4.2.3
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  javascript
---------------------------+------------------------------

Comment (by th23):

 Okay, will try to explain more detailed the steps to reproduce - sorry,
 not that easy:

 Opened in Firefox at window width larger than 955px, everthing is fine.

 If user has scrolled down, the sidebar gets some style defined, e.g.
 offset and position.

 The user now resizes the window to 952px (actually whatever value between
 955px and 59.6875em) the sidebar is not visible anymore :-/ Will attach an
 image right after...

 The reason is, that the media query in CSS removes the sidebar at
 59.6875em, while the JS (see below) already does not update the scroll
 position anymore at 955px - and both values are not necessarily the same
 (presumably due to the way browsers include/exclude the space of the
 scrollbar.

 {{{
         function scroll() {
                 var windowPos = $window.scrollTop();

                 if ( 955 > windowWidth ) {
                         return;
                 }
 }}}

 Does that make it clearer? If not, please donÄt hesitate to ask...

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33143#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list