Lock scrolling of activity card overflow

This commit is contained in:
JonnyWong16 2017-11-06 18:09:35 -08:00
parent c6a36cb4cf
commit 3df31bb01b
3 changed files with 20 additions and 19 deletions

View file

@ -125,7 +125,7 @@ DOCUMENTATION :: END
</div> </div>
<div class="dashboard-activity-info-container"> <div class="dashboard-activity-info-container">
<div class="dashboard-activity-info-scroller scrollbar-macosx"> <div class="dashboard-activity-info-scroller scrollbar-macosx">
<div class="dashboard-activity-info"> <div class="dashboard-activity-info scoller-content">
<ul class="list-unstyled dashboard-activity-info-list"> <ul class="list-unstyled dashboard-activity-info-list">
<li class="dashboard-activity-info-item"> <li class="dashboard-activity-info-item">
<div class="sub-heading">Platform</div> <div class="sub-heading">Platform</div>

View file

@ -119,7 +119,7 @@ DOCUMENTATION :: END
% endif % endif
</div> </div>
<div class="dashboard-stats-info-scroller scrollbar-macosx"> <div class="dashboard-stats-info-scroller scrollbar-macosx">
<div class="dashboard-stats-info"> <div class="dashboard-stats-info scoller-content">
<ul class="list-unstyled dashboard-stats-info-list"> <ul class="list-unstyled dashboard-stats-info-list">
% for row in top_stat['rows']: % for row in top_stat['rows']:
<li class="dashboard-stats-info-item" data-stat_id="${stat_id}" data-art="${row.get('art')}" data-thumb="${row.get('thumb')}" data-platform="${row.get('platform_type')}" <li class="dashboard-stats-info-item" data-stat_id="${stat_id}" data-art="${row.get('art')}" data-thumb="${row.get('thumb')}" data-platform="${row.get('platform_type')}"

View file

@ -215,6 +215,22 @@
time_format = data.time_format; time_format = data.time_format;
} }
}); });
function lockScroll(elem) {
$(elem).each(function (i, instance) {
var childHeight = $(instance).children('.scoller-content').height();
var height = $(instance).height();
var scrollHeight = $(instance).get(0).scrollHeight;
if (childHeight > height) {
$(instance).on('mousewheel', function(e, d) {
if(($(instance).scrollTop() >= (scrollHeight - height)) && d < 0 || ($(instance).scrollTop() <= 0) && d > 0) {
e.preventDefault();
}
});
}
});
};
</script> </script>
% if 'current_activity' in config['home_sections']: % if 'current_activity' in config['home_sections']:
<script> <script>
@ -492,6 +508,7 @@
$('#activity-instance-' + session.session_key + ' .dashboard-activity-info-scroller').scrollbar(); $('#activity-instance-' + session.session_key + ' .dashboard-activity-info-scroller').scrollbar();
$('#activity-instance-' + session.session_key + ' [data-toggle=tooltip]').tooltip({ container: 'body', placement: 'right', delay: 50 }) $('#activity-instance-' + session.session_key + ' [data-toggle=tooltip]').tooltip({ container: 'body', placement: 'right', delay: 50 })
$('#terminate-button-' + session.session_key).tooltip('destroy').tooltip({ container: 'body', placement: 'left', delay: 50 }); $('#terminate-button-' + session.session_key).tooltip('destroy').tooltip({ container: 'body', placement: 'left', delay: 50 });
lockScroll('#activity-instance-' + session.session_key + ' .dashboard-activity-info-scroller');
} }
}); });
} }
@ -610,7 +627,7 @@
complete: function (xhr, status) { complete: function (xhr, status) {
$("#home-stats").html(xhr.responseText); $("#home-stats").html(xhr.responseText);
$('#ajaxMsg').fadeOut(); $('#ajaxMsg').fadeOut();
lockScroll(); lockScroll('#home-stats .dashboard-stats-info-scroller');
} }
}); });
} }
@ -640,22 +657,6 @@
$('#watched-stats-days').tooltip({ container: 'body', placement: 'top', html: true }); $('#watched-stats-days').tooltip({ container: 'body', placement: 'top', html: true });
$('#watched-stats-count').tooltip({ container: 'body', placement: 'top', html: true }); $('#watched-stats-count').tooltip({ container: 'body', placement: 'top', html: true });
function lockScroll() {
$('#home-stats .dashboard-stats-info-scroller.scroll-content').each(function (i, instance) {
var childHeight = $(instance).children('.dashboard-stats-info').height();
var height = $(instance).height();
var scrollHeight = $(instance).get(0).scrollHeight;
if (childHeight > height) {
$(instance).on('mousewheel', function(e, d) {
if(($(instance).scrollTop() >= (scrollHeight - height)) && d < 0 || ($(instance).scrollTop() <= 0) && d > 0) {
e.preventDefault();
}
});
}
});
};
</script> </script>
% endif % endif
% if 'library_stats' in config['home_sections']: % if 'library_stats' in config['home_sections']: