Last active
November 27, 2017 11:41
-
-
Save ScarletPonytail/c6985afac4a19e4a13e355287d6ad3cd to your computer and use it in GitHub Desktop.
CSS / JS / HTML - Off Canvas Top
This file contains hidden or 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
<div class="the-search"> | |
<!-- Something here --> | |
</div> |
This file contains hidden or 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
// Off canvas search (with two separate buttons) | |
$(function() { | |
var expanded = false; | |
$('.appear').click(function() { | |
if (!expanded) { | |
$('.the-search').animate({ 'height': '150px' }, { duration: 400 }); | |
expanded = true; | |
} | |
}); | |
$('.disappear').click(function() { | |
if (expanded) { | |
$('.the-search').animate({ 'height': '0px' }, { duration: 400 }); | |
expanded = false; | |
} | |
}); | |
}); | |
// Off canvas search (with one button) | |
$(function() { | |
var expanded = false; | |
$('.appear').click(function() { | |
if (!expanded) { | |
$('.the-search').animate({ 'height': '150px' }, { duration: 400 }); | |
expanded = true; | |
} else { | |
$('.the-search').animate({ 'height': '0px' }, { duration: 400 }); | |
expanded = false; | |
} | |
}); | |
}); |
This file contains hidden or 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
/* Off Canvas Function */ | |
.the-search { | |
width: 100%; | |
height: 0px; | |
background-color: #009742; | |
position: fixed; | |
overflow: hidden; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment