博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Bootstrap] 8. 'Collapse', data-target, data-toggle & data-parent
阅读量:5329 次
发布时间:2019-06-14

本文共 19735 字,大约阅读时间需要 65 分钟。

Using Bootstrap JavaScript Plugins

If we want to add behavior to our website, which of the following will NOT work?

  • Updating our HTML with data attributes that the Bootstrap JavaScript Library requires.

  • Adding Bootstrap CSS classes to our HTML that the Bootstrap Library requires.

  • Writing JavaScript to perform the behavior.

 

Screen Readers

If we have content that we want to be hidden for visual browsers but show up for screen readers, what class should we use?

Answer: sr-only

 

Accordion to Schedule

The Transportation Safety Board has mandated that we add a few requirements to our site. Apparently it’s some kind of law that we need to disclose safety concerns. Complete the following tasks to implement an Accordion using the Bootstrap Collapse Plugin so we don’t scare people all at once.

      Blasting Off With Bootstrap    

The Fastest Way to Space

Make your way to space in the comfort of your own rocket, elevator or transporter.

Blast off with Bootstrap

Book Today!

Even if you're traveling tomorrow, you can still get tickets today. We have a number of conveniently located ports around the globe to service everyone.

Go Anywhere

If you need to get to space today, why not try out a transporter? Despite the claims, there are have been no deaths in the last 6 weeks!

RocketBus®

For cheapest fares, catch the next RocketBus® to the stars. Cheaper on your wallet, and easiest way to make friends.

Any sufficiently advanced technology is indistinguishable from magic.

Arthur C. Clarke in
Profiles of the Future

Our Transport Systems

Learn more about our transport systems to find out which one is right for you. Pick out the mode of transport that works for your budget and risk level.

Transporter

  • 8 second travel time
  • Chance of death only 1 in 7,593
  • Low price of only $15.99!

Space Elevator

  • 8 hour scenic ride
  • Only 1 horrific death per 12,456
  • Only $45.99 if you book today!

RocketBus

  • 8 minute scenic ride
  • Plunging death rate of under 1/100k
  • $74.99 lets you blast off today!

A dream that became a reality and spread throughout the stars.

Captain Kirk in
Whom Gods Destroy

Plan Your Trip Today!

Todays Time here

Deals here

Forecast

All systems are operational

  • Transporters
  • Space Elevator
  • RocketBus

The National Weather Service has issued a solar flare watch for the following time periods. Please plan accordingly:

  • February 9th, 21:43
  • May 18, 19:82
  • July 4, 08:42

Technically, transporting means making a clone of yourself and killing off the other one. If you believe in a soul, you should be aware of this fact before attempting travel using a transporter.

 

To start off, let’s hide all the content within each panel for when the page loads. Don’t hide the panel titles though – those are the links. What we need to do is start the body of each accordion item as collapsed.

Technically, transporting means making a clone of yourself and killing off the other one. If you believe in a soul, you should be aware of this fact before attempting travel using a transporter.

 

Now all of the panels are collapsed when the page loads! Add a class of in to the body of the "All Systems Operational" panel to make sure it shows when the page loads.

If you're curious how this in class works with the Collapse Plugin, read the.

All systems are operational

 

We're getting somewhere! The page looks correct when it loads, but our links don't do anything yet. Let's make the 2nd panel functional first – the "Weather Alert".

Update the "Weather Alert" link to use the Collapse Plugin. You'll need to add 2 data attributes to the link to make this work.

The National Weather Service has issued a solar flare watch for the following time periods. Please plan accordingly:

  • February 9th, 21:43
  • May 18, 19:82
  • July 4, 08:42

 

Convert the links for "All Systems Operational" and "Transportation Generals Warning: Transporters" to also use the Collapse Plugin.

data-toggle="collapse" data-target="#systemsOperational"  data-toggle="collapse" data-target="#transportationWarning"

 

--------------

      Blasting Off With Bootstrap    

The Fastest Way to Space

Make your way to space in the comfort of your own rocket, elevator or transporter.

Blast off with Bootstrap

Book Today!

Even if you're traveling tomorrow, you can still get tickets today. We have a number of conveniently located ports around the globe to service everyone.

Go Anywhere

If you need to get to space today, why not try out a transporter? Despite the claims, there are have been no deaths in the last 6 weeks!

RocketBus®

For cheapest fares, catch the next RocketBus® to the stars. Cheaper on your wallet, and easiest way to make friends.

Any sufficiently advanced technology is indistinguishable from magic.

Arthur C. Clarke in
Profiles of the Future

Our Transport Systems

Learn more about our transport systems to find out which one is right for you. Pick out the mode of transport that works for your budget and risk level.

Transporter

  • 8 second travel time
  • Chance of death only 1 in 7,593
  • Low price of only $15.99!

Space Elevator

  • 8 hour scenic ride
  • Only 1 horrific death per 12,456
  • Only $45.99 if you book today!

RocketBus

  • 8 minute scenic ride
  • Plunging death rate of under 1/100k
  • $74.99 lets you blast off today!

A dream that became a reality and spread throughout the stars.

Captain Kirk in
Whom Gods Destroy

Plan Your Trip Today!

Todays Time here

Deals here

Forecast

All systems are operational

  • Transporters
  • Space Elevator
  • RocketBus

The National Weather Service has issued a solar flare watch for the following time periods. Please plan accordingly:

  • February 9th, 21:43
  • May 18, 19:82
  • July 4, 08:42

Technically, transporting means making a clone of yourself and killing off the other one. If you believe in a soul, you should be aware of this fact before attempting travel using a transporter.

 

One Accordion at a Time

Our Accordion Component is using the JavaScript Collapse Plugin, but it’s missing something. Clicking on one link in the accordion should collapse the previously open item. In this case, we only want one panel to be open at any given time. Follow the tasks below to make this happen.

It turns out that using the data-target attribute with the Collapse Plugin manages just a single element. If you want to control multiple elements at once that share the same parent, you can instead use the data-parent attribute passing in a shared parent.

Update the "All Systems Operational" link to use this new attribute targeting the parent Panel Group element (.panel-group).

 

We're on the right track, but the other two panels in our accordion component don't know to collapse when the other ones are clicked. Go ahead and update the other two links to also point to the same parent.

      Blasting Off With Bootstrap    

The Fastest Way to Space

Make your way to space in the comfort of your own rocket, elevator or transporter.

Blast off with Bootstrap

Book Today!

Even if you're traveling tomorrow, you can still get tickets today. We have a number of conveniently located ports around the globe to service everyone.

Go Anywhere

If you need to get to space today, why not try out a transporter? Despite the claims, there are have been no deaths in the last 6 weeks!

RocketBus®

For cheapest fares, catch the next RocketBus® to the stars. Cheaper on your wallet, and easiest way to make friends.

Any sufficiently advanced technology is indistinguishable from magic.

Arthur C. Clarke in
Profiles of the Future

Our Transport Systems

Learn more about our transport systems to find out which one is right for you. Pick out the mode of transport that works for your budget and risk level.

Transporter

  • 8 second travel time
  • Chance of death only 1 in 7,593
  • Low price of only $15.99!

Space Elevator

  • 8 hour scenic ride
  • Only 1 horrific death per 12,456
  • Only $45.99 if you book today!

RocketBus

  • 8 minute scenic ride
  • Plunging death rate of under 1/100k
  • $74.99 lets you blast off today!

A dream that became a reality and spread throughout the stars.

Captain Kirk in
Whom Gods Destroy

Plan Your Trip Today!

Todays Time here

Deals here

Forecast

All systems are operational

  • Transporters
  • Space Elevator
  • RocketBus

The National Weather Service has issued a solar flare watch for the following time periods. Please plan accordingly:

  • February 9th, 21:43
  • May 18, 19:82
  • July 4, 08:42

Technically, transporting means making a clone of yourself and killing off the other one. If you believe in a soul, you should be aware of this fact before attempting travel using a transporter.

 

转载于:https://www.cnblogs.com/Answer1215/p/4321055.html

你可能感兴趣的文章
netfilter 和 iptables
查看>>
洛谷P1005 矩阵取数游戏
查看>>
Django ORM操作
查看>>
2012年最佳30款免费 WordPress 主题
查看>>
在Silverlight中使用HierarchicalDataTemplate为TreeView实现递归树状结构
查看>>
HDU-1150 Machine Schedule 二分图匹配
查看>>
单例模式的5种写法
查看>>
安卓问题报告小记(四):Some projects cannot be imported because they already exist in the workspace...
查看>>
显示地图
查看>>
无线通信基础(一):无线网络演进
查看>>
如何在工作中快速成长?阿里资深架构师给工程师的10个简单技巧
查看>>
WebSocket 时时双向数据,前后端(聊天室)
查看>>
关于cocoa 运行时runtime
查看>>
关于python中带下划线的变量和函数 的意义
查看>>
asp.net 写入excel时,不能更新。数据库或对象为只读。
查看>>
linux清空日志文件内容 (转)
查看>>
jsp中对jstl一些标签的引用方式
查看>>
安卓第十三天笔记-服务(Service)
查看>>
css3学习笔记之背景
查看>>
Servlet接收JSP参数乱码问题解决办法
查看>>