Skip to content

Commit

Permalink
fixing sm screen top level item width js
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjasonweaver committed Nov 5, 2013
1 parent 3ec7418 commit 5f81166
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion coffeescripts/jquery.flexnav.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ $.fn.flexNav = (options) ->
count = $top_nav_items.length
nav_width = 100 / count
nav_percent = nav_width+"%"
$top_nav_items.css('width',nav_percent)

# Get the breakpoint set with data-breakpoint
if $nav.data('breakpoint') then breakpoint = $nav.data('breakpoint')
Expand Down Expand Up @@ -83,12 +82,14 @@ $.fn.flexNav = (options) ->
resizer = ->
if $(window).width() <= breakpoint
$nav.removeClass("lg-screen").addClass("sm-screen")
$top_nav_items.css('width','100%')
# Toggle nav menu closed for one pager after anchor clicked
$('.one-page li a').on( 'click', ->
$nav.removeClass('show')
)
else if $(window).width() > breakpoint
$nav.removeClass("sm-screen").addClass("lg-screen")
$top_nav_items.css('width',nav_percent)
# Make sure navigation is closed when going back to large screens
$nav.removeClass('show')
if settings.hoverIntent is true
Expand Down
3 changes: 2 additions & 1 deletion js/jquery.flexnav.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
count = $top_nav_items.length;
nav_width = 100 / count;
nav_percent = nav_width + "%";
$top_nav_items.css('width', nav_percent);
if ($nav.data('breakpoint')) {
breakpoint = $nav.data('breakpoint');
}
Expand Down Expand Up @@ -71,11 +70,13 @@
resizer = function() {
if ($(window).width() <= breakpoint) {
$nav.removeClass("lg-screen").addClass("sm-screen");
$top_nav_items.css('width', '100%');
return $('.one-page li a').on('click', function() {
return $nav.removeClass('show');
});
} else if ($(window).width() > breakpoint) {
$nav.removeClass("sm-screen").addClass("lg-screen");
$top_nav_items.css('width', nav_percent);
$nav.removeClass('show');
if (settings.hoverIntent === true) {
return $('.item-with-ul').hoverIntent({
Expand Down
2 changes: 1 addition & 1 deletion js/jquery.flexnav.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5f81166

Please sign in to comment.