Keep the map visible as the changeset page is scrolled

This commit is contained in:
Saman Bemel-Benrud 2013-06-10 13:52:23 -07:00 committed by Tom Hughes
parent 1998ec88b8
commit 82f8968169
3 changed files with 28 additions and 4 deletions

View file

@ -53,6 +53,14 @@ $(document).ready(function () {
}
});
$(window).scroll(function() {
if ($(window).scrollTop() > $('.content-heading').outerHeight() + $('#top-bar').outerHeight() ) {
$('#changeset_list_map_wrapper').addClass('scrolled');
} else {
$('#changeset_list_map_wrapper').removeClass('scrolled');
}
});
var params = OSM.mapParams();
if (params.bbox) {
map.fitBounds([[params.minlat, params.minlon],

View file

@ -915,17 +915,31 @@ ul.results-list li { border-bottom: 1px solid #ccc; }
}
}
#changeset_list_map_wrapper {
position: absolute;
width: 50%;
height: 490px;
top: 0;
right: 0;
}
#changeset_list_map_wrapper.scrolled {
position: fixed;
}
#changeset_list_map {
position: absolute;
bottom: 20px;
top: 20px;
right: 20px;
width: 45%;
min-height: 398px;
max-height: 598px;
left: 20px;
border: 1px solid #ccc;
}
#changeset_list_map_wrapper.scrolled #changeset_list_map {
margin-left: 93px;
}
/* Rules for the data browser */
.browse-section {

View file

@ -17,7 +17,9 @@
<%= render :partial => 'changeset_paging_nav' %>
<% if @edits.size > 0 %>
<div id='changeset_list_map_wrapper'>
<%= render :partial => 'map' %>
</div>
<div class='column-1'>
<%= render :partial => 'changesets', :locals => { :showusername => !params.has_key?(:display_name) } %>
</div>