Skip to content

Commit

Permalink
Hide menu scrollbar in favor of a shadow as indicator
Browse files Browse the repository at this point in the history
The menu scrollbar is no longer visible, but a shadow above #header-security acts as indicator if there is still items to scroll.
  • Loading branch information
ogizanagi committed Feb 25, 2015
1 parent 498b363 commit f26b05d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Resources/public/javascript/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$(function () {
var hnav = document.getElementById('header-nav');
$(hnav).bind('scroll', dropSidemenuShadow);
$(window).bind('resize', function(){
dropSidemenuShadow.apply(hnav);
});
dropSidemenuShadow.apply(hnav);
});

function dropSidemenuShadow() {
var $hsec = $("#header-security");
if(this.scrollHeight === this.clientHeight) {
$hsec.removeClass('drop-shadow');
return;
}
var scrollPurcent = 100 * this.scrollTop / this.scrollHeight / (1 - this.clientHeight / this.scrollHeight);
isNaN(scrollPurcent) || scrollPurcent >= 100 ? $hsec.removeClass('drop-shadow') : $hsec.addClass('drop-shadow');
}
9 changes: 8 additions & 1 deletion Resources/public/stylesheet/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ body.error code {
margin: 0;
overflow: hidden;
padding: 0 0 1em;
width: 222px;
}
#header #header-nav:hover {
overflow-y: auto;
Expand All @@ -909,7 +910,7 @@ body.error code {
margin-top: 0;
padding: 0;
list-style: none;
width: 100%;
width: 202px;
}
#header #header-menu li {
border-bottom: 1px solid #2B2528;
Expand Down Expand Up @@ -947,6 +948,12 @@ body.error code {
font-size: 14px;
padding-bottom: 1em;
padding-top: 1em;
-moz-transition: box-shadow 0.3s ease-out;
-webkit-transition: box-shadow 0.3s ease-out;
transition: box-shadow 0.3s ease-out;
}
#header #header-security.drop-shadow {
box-shadow: rgba(0,0,0,0.8) 0 -1px 80px;
}
#header #header-security p {
line-height: 1.5;
Expand Down
1 change: 1 addition & 0 deletions Resources/views/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
{% block body_javascript %}
<script src="{{ asset('bundles/easyadmin/javascript/jquery.min.js') }}"></script>
<script src="{{ asset('bundles/easyadmin/javascript/bootstrap.min.js') }}"></script>
<script src="{{ asset('bundles/easyadmin/javascript/admin.js') }}"></script>
{% endblock %}
{% for js_asset in config.assets.js %}
<script src="{{ asset(js_asset) }}"></script>
Expand Down

0 comments on commit f26b05d

Please sign in to comment.