Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Foundation Magellan Navigation

Foundation Magellan Navigation


How to Create Magellan Navigation

Magellan navigation is a navigation index, created as follows:

Example

<

div

data-magellan-expedition=

"fixed"

<

dl

class=

"sub-nav"

<

dd

data-magellan-arrival=

"page1"

<

a

href=

"#page1"

Page 1

<

/a

<

/dd

<

dd

data-magellan-arrival=

"page2"

<

a

href=

"#page2"

Page 2

<

/a

<

/dd

<

/dl

<

/div

<

h3

data-magellan-destination=

"page1"

Page1

<

/h3

<

a

name=

"page1"

<

/a

...

<

h3

data-magellan-destination=

"page2"

Page2

<

/h3

<

a

name=

"page2"

<

/a

...

<

script

$(document).ready(function() {

    $(document).foundation();

})

<

/script

Try it »

Example Parsing

in

element, add the data-magellan-expedition="fixed" attribute to create Magellan navigation.

Then in

or
  • on the element, add data-magellan-arrival="value" attribute, followed by a link with the same value as the attribute (page1).

    Use data-magellan-destination="value" attribute to control the target of Magellan navigation, followed immediately by the element, add name="value" attribute. The values of the two attributes must be consistent with data-magellan-arrival the value of (page1)。

    Finally, initialize Foundation JS. When the user scrolls the page, the navigation will automatically switch according to the currently displayed content.


    Magellan Navigation Header Toolbar

    Example of Magellan navigation using a header toolbar:

    Example

    <
    
    div
    
    data-magellan-expedition=
    
    "fixed"
    
    <
    
    nav
    
    class=
    
    "top-bar"
    
    data-topbar

        ...

       

    <
    
    section
    
    class=
    
    "top-bar-section"
    
    <
    
    ul
    
    class=
    
    "left"
    
    <
    
    li
    
    data-magellan-arrival=
    
    "page1"
    
    <
    
    a
    
    href=
    
    "#page1"

    Page 1

    <
    
    /a
    
    <
    
    /li
    
    <
    
    li
    
    data-magellan-arrival=
    
    "page2"
    
    <
    
    a
    
    href=
    
    "#page2"

    Page 2

    <
    
    /a
    
    <
    
    /li
    
    <
    
    /ul
    
    <
    
    /section
    
    <
    
    /nav
    
    <
    
    /div
    
    <
    
    h3
    
    data-magellan-destination=
    
    "page1"
    
    Page1
    
    <
    
    /h3
    
    <
    
    a
    
    name=
    
    "page1"
    
    <
    
    /a

    ...

    <
    
    h3
    
    data-magellan-destination=
    
    "page2"
    
    Page2
    
    <
    
    /h3
    
    <
    
    a
    
    name=
    
    "page2"
    
    <
    
    /a

    ...

    Try it »


    Magellan Navigation Padding

    By default, Magellan navigation's

    element has 10px of padding. You can remove it with CSS:

    Example

    [data-magellan-expedition], [data-magellan-expedition-clone]

    {

       

    padding:

    0;

    }

    Try it »


    Magellan Navigation Options

    Use the data-options attribute to modify Magellan navigation settings, for example

    :

    Name Type Default Description Example
    active_class string active Specify the class for the active link Try it
    threshold number 0 Specify when the navigation needs a fixed position. It is calculated based on scrollbar scrolling, default is 0 (auto). Try it
    destination_threshold number 20 This value sets the distance from the top of the navigation list when the navigation link is shown as active (blue background). Try it
    fixed_top number 0 Specifies the pixel value of the navigation bar's distance from the header Try it