forked from railsbridge/bridge_troll
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move javascript that was sitting in application.css into separate files
- Loading branch information
1 parent
da4e665
commit e9cd1db
Showing
3 changed files
with
28 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$(document).ready(function () { | ||
if ($(window).height() < $('html').height()) { | ||
$('footer').show(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$(document).ready(function () { | ||
function matchHeights ($element) { | ||
var items = $element.find('.js-match-height-item'); | ||
items.css('min-height', 0); | ||
|
||
var maxHeight = Math.max.apply(Math, _.map(items, function(item) { | ||
return $(item).outerHeight(); | ||
})); | ||
items.css('min-height', maxHeight); | ||
} | ||
|
||
function setupHeightMatching ($element) { | ||
$(window).resize(_.debounce(function() { | ||
if ($(document).width() > 768) { | ||
matchHeights($element); | ||
} | ||
}, 100)); | ||
|
||
matchHeights($element); | ||
} | ||
|
||
setupHeightMatching($('body')); | ||
}); |