Skip to content

webbrandon/bootstrap.jquery.scrollfade.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

bootstrap.jquery.scrollfade.js

Bootstrap Plugin for Jquery Scrollfade
Author: @Brandon L. Clark support@themindspot.com

#Description This is a plugin for those who wish to use the navbar component of Bootstrap because they are using the Scrollfade plugin for jquery. It acts like scrollspy.js but because of the way Scrollfade embeds data to perform its visual effect scrollspy will not work. It also adds a smooth scroll effect for same page navigation.

#Requires

#Example You can find an example file in this repository. Feel free to use and modify the code.

#How to use bootstrap.jquery.scrollfade CSS

Two elements need to be given positioning and size settings. The body needs to be fixed to all borders or Scrollfade will not work. #content-scroll needs to be relative so the content area can be correctly sized to navbar.

body {
  position:fixed;
  top:0;
  bottom:0;
  left:0;
  right:0;
  padding-bottom:50px;
  height:100%;
}
#content-scroll {
  overflow:auto;
  position:relative;
  margin-top:50px;
  height:100%;
}

HTML

The basic html structure is simliar to that needed to create a Bootstrap navbar component. The content needs to be nested in a element after the navigation. (Note: Bootstrap classes have been left out)

<body>
  <nav>
    ...
  </nav>
  <div id="content-scroll">
    ... (Sections are given trigger class to notify nav, example uses .sh)
  </div>
</body>

JavaScript

You need to target the element that has your nested content (eg: $('#content-area').scrollfade() ). To init bootstrap.jquery.scrollfade.js add .scrollfadeBootstrap() with your navigation sections target component after scrollfade().

$(function(){
  $('#content-scroll').scrollfade().scrollfadeBootstrap('.sh');
});

About

Bootstrap Plugin for Jquery Scrollfade

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 74.2%
  • CSS 13.3%
  • HTML 12.5%