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

本文共 19613 字,大约阅读时间需要 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.

 

转载地址:http://anoox.baihongyu.com/

你可能感兴趣的文章
AHK按键转载
查看>>
请求转发和重定向的区别及应用场景分析
查看>>
深浅拷贝 python
查看>>
C++ gui程序附加dos输出窗口
查看>>
jQuery验证控件jquery.validate.js使用说明+中文API
查看>>
Linux 查看.so中导出函数
查看>>
1.1 什么是Python
查看>>
powerDesigner如何动态显示mysql数据库表结构
查看>>
event兼容性解决
查看>>
JS原型链继承
查看>>
poj Matrix Power Series 矩阵幂求和
查看>>
Java锁--CyclicBarrier
查看>>
string 常用转换
查看>>
最优化理论与方法(袁亚湘 孙文瑜)笔记(一)
查看>>
前端真的能做到彻底权限控制吗?
查看>>
数组中简便方法求最大值,最小值,平均值,求和,和个数
查看>>
SAX, JSON , DOM 数据解析
查看>>
洛谷P4219 大融合
查看>>
adb 查看 android手机的CPU架构
查看>>
Java概述
查看>>