BBOOOOTTSSTTRRAAPP SSCCRROOLLLLSSPPYY PPLLUUGGIINN

BOOTSTRAP SCROLLSPY PLUGIN



Copyright ?

The Scrollspy autoupdatingnav plugin allows you to target sections of the page based on the scroll position. In its basic implementation, as you scroll, you can add .active classes to the navbar based on the scroll position.

If you want to include this plugin functionality individually, then you will need scrollspy.js. Else, as mentioned in the chapter Bootstrap Plugins Overview, you can include bootstrap.js or the minified bootstrap.min.js.

Usage

You can add scrollspy behavior to your topbar navigation:

Via data attributes : add data-spy="scroll" to the element you want to spy on typicallythebody. Then add attribute data-target with the ID or class of the parent element of any Bootstrap .nav component. For this to work, you must have elements in the body of the page that have matching IDs of the links that you are spying on.

... ... ...

Via JavaScript : You can invoke the scrollspy with JavaScript instead of using the data attributes, by selecting the element to spy on, and then invoking the .scrollspy function:

$('body').scrollspy({ target: '.navbar-example' })

Example

The following example shows the use of scrollspy plugin via data attributes:

Toggle navigation Tutorial Name iOS SVN Java

jmeter ejb spring iOS iOS is a mobile operating system developed and distributed by Apple Inc. Originally released in 2007 for the iPhone, iPod Touch, and Apple TV. iOS is derived from OS X, with which it shares the Darwin foundation. iOS is Apple's mobile version of the OS X operating system used on Apple computers. SVN Apache Subversion which is often abbreviated as SVN, is a software versioning and revision control system distributed under an open source license. Subversion was created by CollabNet Inc. in 2000, but now it is developed as a project of the Apache Software Foundation, and as such is part of a rich community of developers and users. jMeter jMeter is an Open Source testing software. It is 100% pure Java application for load and performance testing. EJB Enterprise Java Beans (EJB) is a development architecture for building highly scalable and robust enterprise level applications to be deployed on J2EE compliant Application Server such as JBOSS, Web Logic etc. Spring Spring framework is an open source Java platform that provides comprehensive infrastructure support for developing robust Java applications very easily and very rapidly. Spring framework was initially written by Rod Johnson and was first released under the Apache 2.0 license in June 2003.

Options

Options can be passed via data attributes or JavaScript. Following table lists the options:

Option Name offset

Type/Default Value number Default: 10

Data attribute name data-offset

Description Pixels to offset from top when calculating position of scroll.

Methods

.scrollspyrefresh : When calling the scrollspy via the JavaScript method, you need to call the .refresh method to update the DOM. This is helpful if any elements of the DOM have changed i.e if you have added or removed some elements. Following would be the syntax to use this method.

$('[data-spy="scroll"]').each(function () { var $spy = $(this).scrollspy('refresh')

})

Example

The following example demonstrates the use of.scrollspyrefresh method:

Toggle navigation Tutorial Name iOS SVN Java jmeter ejb spring

× Remove this section

iOS is a mobile operating system developed and distributed by Apple Inc. Originally released in 2007 for the iPhone, iPod Touch, and Apple TV. iOS is derived from OS X, with which it shares the Darwin foundation. iOS is Apple's mobile version of the OS X operating system used on Apple computers. SVN Apache Subversion which is often abbreviated as SVN, is a software versioning and revision control system distributed under an open source license. Subversion was created by CollabNet Inc. in 2000, but now it is developed as a project of the Apache Software Foundation, and as such is part of a rich community of developers and users.

× Remove this section jMeter is an Open Source testing software. It is 100% pure Java application for load and performance testing. EJB Enterprise Java Beans (EJB) is a development architecture for

building highly scalable and robust enterprise level applications to be deployed on J2EE compliant Application Server such as JBOSS, Web Logic etc. Spring Spring framework is an open source Java platform that provides comprehensive infrastructure support for developing robust Java applications very easily and very rapidly. Spring framework was initially written by Rod Johnson and was first released under the Apache 2.0 license in June 2003. $ (function(){ removeSection = function(e) { $ (e).parents(".section").rem ove(); $('[data-spy="scroll"]').each(function () { var $spy = $(this).scrollspy('refresh') }); } $ ("#m yScrollspy").scrollspy(); });

Events

The following table lists the events to work with scrollspy. This event may be used to hook into the function.

Event

Description

Example

activate.bs.scrollspy

This event fires whenever a new item becomes activated by the scrollspy.

$ ('#m yScrollspy').on('activate.bs.scrollspy', function () {

// do something... })

Example

The following example demonstrates the use ofactivate.bs.scrollspy event:

Toggle navigation Tutorial Name iOS SVN Java jmeter ejb spring

× Remove this section

iOS is a mobile operating system developed and distributed by

Apple Inc. Originally released in 2007 for the iPhone, iPod Touch, and Apple TV. iOS is derived from OS X, with which it shares the Darwin foundation. iOS is Apple's mobile version of the OS X operating system used on Apple computers. SVN Apache Subversion which is often abbreviated as SVN, is a software versioning and revision control system distributed under an open source license. Subversion was created by CollabNet Inc. in 2000, but now it is developed as a project of the Apache Software Foundation, and as such is part of a rich community of developers and users. × Remove this section jMeter is an Open Source testing software. It is 100% pure Java application for load and performance testing. EJB Enterprise Java Beans (EJB) is a development architecture for building highly scalable and robust enterprise level applications to be deployed on J2EE compliant Application Server such as JBOSS, Web Logic etc. Spring Spring framework is an open source Java platform that provides

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download