Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*js for floating any section*/
- $(function() {
- var navbar = $('#ic-floating');
- var offset = navbar.offset();
- var objectHeight = navbar.outerHeight();
- var windowHeight = $(window).height();
- $(window).scroll(function () {
- var scrollTop = $(window).scrollTop() + ( windowHeight - objectHeight ); // check the visible top of the browser
- if (offset.top <= scrollTop) {
- navbar.addClass('sticky');
- } else {
- navbar.removeClass('sticky');
- }
- });
- });
- /*CSS*/
- .ic-sticky {
- position: fixed;
- bottom: 0;
- width: 100%;
- background-color: #fff;
- z-index: 2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement