[openstreetmap/openstreetmap-website] Reverse welcome banner show/hide logic (#1990)

mmd notifications at github.com
Mon Sep 10 19:53:34 UTC 2018


mmd-osm commented on this pull request.



> @@ -187,8 +187,10 @@ $(document).ready(function () {
     $.cookie('_osm_location', OSM.locationCookie(map), { expires: expiry, path: '/' });
   });
 
-  if ($.cookie('_osm_welcome') === 'hide') {
-    $('.welcome').hide();
+  if ($.cookie('_osm_welcome') !== 'hide' &&
+     (typeof window.matchMedia !== "function" ||
+     !window.matchMedia("only screen and (max-width:768px)").matches)) {

Sure. This may really be kind of an overkill, and it's only useful for mobile devices anyway. I'm perfectly fine to remove those two lines 191+192 again. Their only purpose is to skip `$('.welcome').show()`, if the screen is too small. 

Reason being that small.scss defines the following `display:none` with `!important`. So whatever we try to do in terms of show(), it gets overruled immediately (with some flickering on the mobile screen again).

```
  #sidebar .welcome,
  #sidebar #banner {
    display: none !important;
  }
```

According to https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia#Browser_compatibility, window.matchMedia support is quite good. Line 191 should cover those browsers, where it's not yet supported.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1990#discussion_r216451458
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20180910/13f57134/attachment.html>


More information about the rails-dev mailing list