Avoid flickering welcome banner

Make the welcome banner default to being hidden and then show
it (by adding a class) if there is no cookie.

Fixes #1951
This commit is contained in:
Tom Hughes 2018-09-10 21:21:43 +01:00
parent a7cdb0298d
commit 1a66467ef6
3 changed files with 18 additions and 8 deletions

View file

@ -187,12 +187,12 @@ $(document).ready(function () {
$.cookie('_osm_location', OSM.locationCookie(map), { expires: expiry, path: '/' }); $.cookie('_osm_location', OSM.locationCookie(map), { expires: expiry, path: '/' });
}); });
if ($.cookie('_osm_welcome') === 'hide') { if ($.cookie('_osm_welcome') !== 'hide') {
$('.welcome').hide(); $('.welcome').addClass('visible');
} }
$('.welcome .close-wrap').on('click', function() { $('.welcome .close-wrap').on('click', function() {
$('.welcome').hide(); $('.welcome').removeClass('visible');
$.cookie('_osm_welcome', 'hide', { expires: expiry, path: '/' }); $.cookie('_osm_welcome', 'hide', { expires: expiry, path: '/' });
}); });

View file

@ -611,11 +611,18 @@ body.compact {
height: auto; height: auto;
overflow: hidden; overflow: hidden;
#banner, #banner {
.welcome {
display: block; display: block;
} }
.welcome {
display: none;
&.visible {
display: block;
}
}
#sidebar_content { #sidebar_content {
display: none; display: none;
} }

View file

@ -126,9 +126,12 @@ body.small {
} }
} }
#sidebar .welcome, .overlay-sidebar #sidebar .welcome.visible {
#sidebar #banner { display: none;
display: none !important; }
.overlay-sidebar #sidebar #banner {
display: none;
} }
.leaflet-top.leaflet-right { .leaflet-top.leaflet-right {