Skip to content

Instantly share code, notes, and snippets.

@ju1
Last active April 29, 2024 18:17
Show Gist options
  • Save ju1/8e4bcc30ccf8e260a3283c82f5a57d37 to your computer and use it in GitHub Desktop.
Save ju1/8e4bcc30ccf8e260a3283c82f5a57d37 to your computer and use it in GitHub Desktop.
Demo bar
<style type="text/css">
#bn-bar {
-moz-transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-transition: all 0.5s ease;
position: fixed;
-webkit-transform: translateZ(0);
width: 100%;
height: 40px;
line-height:40px;
top: -35px;
font-size:14px;
z-index: 10000;
background-color:#FF9900;
font-family: "Helvetica Neue", "Arial", sans-serif;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.2);
-moz-box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.2);
box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.2);
text-align:center;
}
#hider {
height:100%;
width:30px;
z-index:10001;
float:right;
background-color:#efefef;
background-image:url('close_small.png');
background-position: 7px 5px;
background-repeat:no-repeat;
}
#hider:hover {
background-color:#fff;
cursor:pointer;
}
</style>
<script>
var autohide;
$('body').prepend('<div id="bn-bar"><b>Need help or advice? <a href="#">Contact us</a> and we\'ll help you right away!</a></div>');
$(document).ready(function(){
$("#hider").click(function(){
$("#bn-bar").animate({
top: "-50"
}, "fast","linear", function(){});
})
$("#bn-bar").mouseover(function(){clearTimeout(autohide);});
setTimeout(function(){$("#bn-bar").animate({top: "0"}, "slow","linear", function(){});},2500);
autohide = setTimeout(function(){$("#bn-bar").animate({top: "-30"}, "fast","linear", function(){});},10000);
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment