Skip to content

Commit

Permalink
Modify ToC status change logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-yamashita committed May 5, 2015
1 parent 47b5161 commit 730a85a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
7 changes: 4 additions & 3 deletions app/assets/javascripts/articles.js.coffee.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ $ ->
e.stopImmediatePropagation()
$tocArea = $(this).parent()
$ul = $(this).siblings('ul')
$ul.toggle()
if $ul.is(':visible')
$tocArea.css('width', 'inherit')
$ul.hide()
$tocArea.attr('data-opened', 'false')
else
$tocArea.css('width', '')
$ul.show()
$tocArea.attr('data-opened', 'true')
21 changes: 18 additions & 3 deletions app/assets/stylesheets/application.css.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -159,24 +159,39 @@ h1 {
}

.markdown .markdown-toc {
width: 70px;
border: 1px solid $gray-light;
@include border-radius($border-radius-base);
width: 70px;

h1 {
background-color: lighten($gray-light, 10%);
box-shadow: inset 1px 1px 15px -5px #fff;
@include border-radius($border-radius-base);
font-size: $font-size-h3 * 0.7;
margin: 0;
@include border-radius($border-radius-base);

&:hover {
background-color: lighten($gray-light, 15%);
cursor: pointer;
}
}

> ul {
display: none;
margin-top: 15px;
display: none;
}

&[data-opened="true"] {
width: inherit;

h1 {
border-radius: 4px 4px 0 0;
border-bottom: 1px solid $gray-light;
}

> ul {
display: block;
}
}
}

Expand Down

0 comments on commit 730a85a

Please sign in to comment.