Last active
December 10, 2015 13:58
-
-
Save albybarber/4444173 to your computer and use it in GitHub Desktop.
jQuery.sticky() is a jQuery plugin that adds bar at the bottom of the users screen with the pages primary actions if they are not within the users viewport. e.g. At the bottom of the screen and need to be scrolled to view.
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
<!doctype html> | |
<title>Demo</title> | |
<link rel="stylesheet" href="styles.css" /> | |
<div class="tall-element"></div> | |
<div class="sticky-element"> | |
<p>Try resizing the window's height..</p> | |
</div> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script src="flipreversestickynavthatollywants.js"></script> | |
<script> | |
jQuery(function() { | |
jQuery('.sticky-element').sticky(); // run .ready or when required | |
}); | |
</script> |
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
body { | |
margin: 0; | |
padding: 0; | |
background-color: salmon; | |
} | |
.tall-element{ | |
height: 400px; | |
} | |
.sticky-element { | |
position: relative; | |
padding: 0 0 0 50px; | |
} | |
.sticky-element p { | |
font-family: sans-serif; | |
font-size: 2em; | |
color: #fff; | |
margin: 0; | |
} | |
.is_stuck { | |
-webkit-transition: background-color 0.35s ease-in-out; | |
-moz-transition: background-color 0.35s ease-in-out; | |
-ms-transition: background-color 0.35s ease-in-out; | |
-o-transition: background-color 0.35s ease-in-out; | |
transition: background-color 0.35s ease-in-out; | |
padding: 5px 0 5px 50px; | |
background-color: rgba(44, 44, 44, 0.64); | |
position: fixed; | |
left: 0px; | |
bottom: 0px; | |
width: 100%; | |
z-index: 2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's great Alby but it's still possible to have the text hidden.
Also, no point linking to Confluence as no one will be able to access it ;)