GithubHelp home page GithubHelp logo

sitckynav's Introduction

#Sticky Nav This is some simple JS code that will allow a navigation bar that is placed below the top of a webpage to "stick" to the top of the browser window once the navigation bar is reached when scrolling.

##Setup Add the following two lines of code to the head section of your HTML file(s).

<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>

<script src="//code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>

Then download the stickyNav.js file above and save it to a location within your website directory, for example in a folder called "scripts".

Finally add the following line of code to the head section of your HTML file(s), making sure to edit the src attribute to the location that you saved stickyNav.js to.

<script src="link/to/stickyNav.js"></script>

##Usage In order for the scroll funciton to work correctly you need to give the sticky-header class to your navigation bar.

When it is time for your navagation bar to stick a class of "sticky" will be applied to the navigation bar. We will use css styles to actually controll the "sticking" of the element. Below is some starting CSS code that can be customised to work however you want it to.

.sticky {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
}

sitckynav's People

Contributors

mdcanham avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.