Little bootstrap knowledge, little bootstrap knowledge

Source: Internet
Author: User

Little bootstrap knowledge, little bootstrap knowledge

At the end of the year, there was no project to do. I sorted out the bootstrap knowledge recently used by my website.

I. Import bootstrap styles and scripts

    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />    <script src="js/bootstrap.min.js" type="text/javascript"></script>

Ii. navigation bar

<Div class = "navbar-fixed-top"> <div class = "navbar-inner"> <div class = "container"> <a class = "brand pull-left "href =" # "> RenderKa </a> <a class =" btn-navbar "data-toggle =" collapse "data-target = ". nav-collapse "> <span class =" icon-bar "> </span> <span class =" icon-bar "> </span> <span class =" icon- bar "> </span> </a> <div class =" nav-collapse "> <div class =" icon_home "> <a href =" Index. aspx "target =" _ blank "> CN </a>/EN </div> <ul id =" nav-list "class =" nav pull-right "> <li> <a href = "# price"> Price </a> </li> <a href = "# support"> Support </a> </li> <li> <a href = "# workflow"> Workflow </a> </li> <a href = "# contact"> Contact </a> </ li> </ul> </div>View Code

1. navbar classAdd class. Navbar-fixed-top: indicates to pin the navigation bar to the top of the page.

2.. brand class: displayed in different ways

3.. pull-left: Align to the left

4,To add responsive features to the navigation bar, the content you want to collapse must be wrapped in. Collapse,. Navbar-collapseIn <div>. The collapsed navigation bar is actually a class. Navbar-toggleAnd two data-element buttons. The first one isData-toggleTo tell JavaScript what to do with the button. The second isData-targetIndicates the element to switch. Three. Icon-bar<Span> Create a hamburger button. These will be switched. Nav-collapse<Div>.

3. layout containers

<Div class = "container-fluid"> <div class = "row-fluid" id = "workflow">

1. container class:Containers with fixed width and responsive layout supported

2. container-fluid:Container used for the 100%-width, occupying all the viewports

3. Up to 12 spans in one row

4. Rolling monitoring

1. Introduce js: <script src = "js/bootstrap-scrollspy.js" type = "text/javascript"> </script>

2. (1) Add to the element you want to listen to (usually the body)Data-spy = "scroll ",Then add the ID of the parent element with the Bootstrap. nav component or the attribute data-target of the class.

(2)

$("#nav-list li, #scroll_up").click(function(e) {        e.preventDefault();         $('html, body').animate({                scrollTop: $($(this).children("a").attr("href")).offset().top         },1500);    });    

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.