02.06.2015 Views

Bootstrap Tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ut enim lobortis pellentesque ultricies ac ligula. Pellentesque<br />

convallis elit nisi, id vulputate ipsum ullamcorper ut. Cras<br />

ac pulvinar purus, ac viverra est. Suspendisse potenti. Integer<br />

pellentesque neque et elementum tempus. Curabitur bibendum in<br />

ligula ut rhoncus.<br />

Quisque pharetra velit id velit iaculis pretium. Nullam a<br />

justo sed ligula porta semper eu quis enim. Pellentesque<br />

pellentesque, metus at facilisis hendrerit, lectus velit<br />

facilisis leo, quis volutpat turpis arcu quis enim. Nulla<br />

viverra lorem elementum interdum ultricies. Suspendisse<br />

accumsan quam nec ante mollis tempus. Morbi vel accumsan diam,<br />

eget convallis tellus. Suspendisse potenti.<br />

<br />

<br />

<br />

<br />

$(function () {<br />

$('#myNav').affix({<br />

offset: {<br />

top: 60<br />

}<br />

});<br />

});<br />

<br />

Positioning via CSS<br />

In both the above situations, you must provide CSS for the positioning of your content. The affix plugin toggles<br />

between three classes, each representing a particular state: .affix, .affix-top, and .affix-bottom. Follow the below<br />

steps to set your CSS for either of the above usage options.<br />

To start, the plugin adds .affix-top to indicate the element is in it's top-most position. At this point no CSS<br />

positioning is required.<br />

Scrolling past the element you want affixed should trigger the actual affixing. This is<br />

where .affixreplaces .affix-top and sets position: fixed; (provided by <strong>Bootstrap</strong>'s code CSS).<br />

If a bottom offset is defined, scrolling past that should replace .affix with .affix-bottom. Since offsets are<br />

optional, setting one requires you to set the appropriate CSS. In this case, addposition: absolute; when<br />

necessary.<br />

TUTORIALS POINT<br />

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!