I'm trying to get two different cards to update their active tab-pane using one nav-link.
Here is my code. As you can see, I have one card that has act info and one that has the corresponding video in it. When I click to see the other act info, I want the video to also change (at the moment there is no second video - it just says 'stuff number 2'
<div class="row pt-5" id="acts">
<div class="col-md-4 offset-md-1">
<div class="card">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#act1" role="tab">Take Five</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#act2" role="tab">Thank You For Your Consideration</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="act1" role="tabpanel">
<div class="card-block">
<h3 class="card-title">Take Five</h3>
<p class="card-text">Do you also have trouble getting out of bed? Working 9 to 5, the same routine every day.. “Take Five” is about one of those days, a light hearted piece full of absurdness and acrobatics. People of all ages can enjoy the 7- minute act, let Ida surprise you!</p>
</div>
</div>
<div class="tab-pane" id="act2" role="tabpanel">
<div class="card-block">
<div class="container">
<div class="row">
<div class="col-md-9">
<h3 class="card-title">Thank You For Your Consideration</h3>
<p class="card-text">What do you write in a letter when you apply for a job? Everybody has been there, behind a computer screen, mind blank. It sounds too pretentious or too insecure. If only they would see the real you. But if that’s a good idea.. An act about struggles that everyone has experienced, brought with humour, brutal honesty and creativity in movement. Ida’s genuine story is a 6 minute text-based circus performance.</p>
</div>
<div class="col-md-3">
<img src="" alt="TYFYC" class="img-fluid img-rounded">
</div>
</div>j
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-5 offset-md-2">
<div class="card">
<div class="tab-content">
<div class="tab-pane active" id="act1" role="tabpanel">
<div class="card-block">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://player.vimeo.com/video/220114759" allowfullscreen></iframe>
</div>
</div>
</div>
<div class="tab-pane" id="act2" role="tabpanel">
Stuff number 2
</div>
</div>
</div>
</div>
</div>
Is there a way to do this without using a javascript .addClass('active')?
Related
I'm using bootstrap 4 in a web application for organizing topography measurements.
On one page, a plot of such a topography is shown in an <div class='tab-content'> element.
There are two navigation pills, "Plot" and "Properties", which allow to select the tab contents.
Here is a simplified version of the original markup:
<div class="container">
<div class="row">
<!-- The leftmost column contain a vertical navigation bar -->
<div class="col-md-1 mb-2 border-right">
<div class="nav nav-pills flex-column" role="tablist" aria-orientation="vertical">
<a class="nav-link active" data-toggle="tab" href="#plot" role="tab">Plot</a>
<a class="nav-link" data-toggle="tab" href="#properties" role="tab">Properties</a>
</div>
</div>
<!-- Columns in the middle change depending on selected pill-->
<div class="col-8">
<div class="tab-content mt-2">
<div class="tab-pane fade active show" id="plot" role="tabpanel" aria-labelledby="plot-tab">
Some plot.
</div>
<div class="tab-pane fade" id="properties" role="tabpanel" aria-labelledby="properties-tab">
Some properties.
</div>
</div>
</div>
<!-- Rightmost 3 columns are a button area -->
<div class="col-3">
<div class="row p-3 pull-right">
<button class="btn btn-primary">
A button
</button>
</div>
</div>
</div>
And here is a fiddle, where you can see it in action.
The pills work, but my problem is that sometimes in my application (depending on the zoom level of my page) and also in the fiddle, the blue background of the selected pill overlaps with the border and with the tab contents:
Could someone give me a hint how to prevent the pills from overlapping, e.g. by CSS?
I would like to have the pills completely on the left of the vertical border.
leftmost column is overflowing the content because of col-1 , you can use bootstrap media query (xs, sm, md, lg, xl) for dividing columns.
<div class="container">
<div class="row">
<!-- The leftmost column contain a vertical navigation bar -->
<div class="col-md-3 col-4 mb-2 border-right">
<div class="nav nav-pills flex-column" role="tablist" aria-orientation="vertical">
<a class="nav-link active" data-toggle="tab" href="#plot" role="tab">Plot</a>
<a class="nav-link" data-toggle="tab" href="#properties" role="tab">Properties</a>
</div>
</div>
<!-- Columns in the middle change depending on selected pill-->
<div class="col-md-6 col-8">
<div class="tab-content mt-2">
<div class="tab-pane fade active show" id="plot" role="tabpanel" aria-labelledby="plot-tab">
Some plot.
</div>
<div class="tab-pane fade" id="properties" role="tabpanel" aria-labelledby="properties-tab">
Some properties.
</div>
</div>
</div>
<!-- Rightmost 3 columns are a button area -->
<div class="col-md-3">
<div class="row p-3 pull-right">
<button class="btn btn-primary">
A button
</button>
</div>
</div>
</div>
</div>
I'm working on a Spring-Boot application using Thymeleaf. Bootstrap4 is the CSS framework I'm using. I'm using nav-tabs for the profile page and the first three tabs don't have any issues but when I click on the address tab and go to any other tab, the content of the Address tab, shows up in the other tabs at the bottom of that tabs content and I cannot figure out why. I'll be including images of the outcome and css of each starting tab. I am hesitant to include the entire page html due to the amount of lines currently (480 total)
<div class="tab-pane fade" id="tab-3" role="tabpanel" th:classappend="${classActiveBilling}? 'in active show'">
<div class="card">
<div class="card-body">
<div class="card-title">
<div class="container">
<div class="row">
<div class="col">
<h4 class="mb-0 align-middle" style="margin-top: 15px;">Billing Information</h4>
</div>
</div>
<div class="row">
<div class="col">
<div class="breadcrumb" style="background-color:transparent;">
<a class="breadcrumb-item active" th:href="#{/listOfCreditCards}" th:style="${listOfCreditCards}? 'color:#6e45e0'">List of Credit Cards</a>
<a class="breadcrumb-item active" th:href="#{/addNewCreditCard}" th:style="${addNewCreditCard}? 'color:#6e45e0'">Add/Update Credit Card</a>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab-4" role="tabpanel" th:classappend="${classActiveShipping}? 'in active show'">
<div class="card">
<div class="card-body">
<div class="card-title">
<div class="container">
<div class="row">
<div class="col">
<h4 class="mb-0 align-middle" style="margin-top: 15px;">Shipping Information</h4>
</div>
</div>
<div class="row">
<div class="col">
<div class="breadcrumb" style="background-color:transparent;">
<a class="breadcrumb-item active" th:href="#{/listOfShippingAddresses}" th:style="${listOfShippingAddresses}? 'color:#6e45e0'">List of Shipping Addresses</a>
<a class="breadcrumb-item active" th:href="#{/addNewShippingAddress}" th:style="${addNewShippingAddress}? 'color:#6e45e0'">Add/Update Shipping Address</a>
</div>
</div>
</div>
The breadcrumbs were the culprit. It was causing the shipping tab to show up in other windows. I just changed it to a button group and get the same effect. I unfortunately could not get the breadcrumbs themselves to work regardless of how many times I worked on the css so just threw it out completely. Semi answer, but thymeleaf is touchy and doesn't always play nice with frameworks.
Currently I have this web page:
as it shows in the image, I want the main text to come right after the heading, but the sidebar pushes it down. How can I fix this problem?
The code is:
<div class="row content-area-main">
<div class="col-md-4">
<img src="img/double-lily-modified3.png" alt="LilyPond logo">
</div>
<div class="col-md-5 header-info">
<h1 class="header-info-title">LilyPond</h1>
<p>... music notation for everyone</p>
</div>
<div class="col-md-3">
<div class="card card-block">
<h4 class="card-title">Stable Release</h4>
<ul class="list-group list-group-flush">
<li class="list-group-item">Download 2.18.2</li>
<li class="list-group-item">Manuals 2.18.2</li>
</ul>
</div>
<div class="card card-block">
<h4 class="card-title">Unstable Release</h4>
<ul class="list-group list-group-flush">
<li class="list-group-item">Download 2.19.51</li>
<li class="list-group-item">Manuals 2.19.51</li>
</ul>
</div>
<div class="card card-block">
<h4 class="card-title">Pondings</h4>
<p>The LilyPond Blog is up and running here! Anyone can follow and leave comments on the blog. To contribute, contact Urs Liska.</p>
</div>
</div>
</div>
<div class="row content-area-main">
<div class="col-md-8">
<p>LilyPond is a music engraving program, devoted to producing the highest-quality sheet music possible. It brings the aesthetics of traditionally engraved music to computer printouts. LilyPond is free software and part of the GNU Project.</p>
<p class="header-info-link">Read more in our Introduction!</p>
</div>
</div>
<div class="row content-area">
<div class="col-md-8">
<div class="card card-block">
<h4 class="card-title">Beatuiful Sheet Music</h4>
<img src="img/bwv861-lilypond.png" class="img-fluid img-thumbnail card-image-custom" width="100%">
<p class="card-text">LilyPond is a powerful and flexible tool for engraving tasks of all kinds, for example classical music (like the example above by J.S. Bach), complex notation, early music, modern music, tablature, vocal music, lead sheets, educational materials, large orchestral projects, customized output, and even Schenker graphs.</p>
<span class="card-link">Browse our gallery of Examples and be inspired!</span>
</div>
</div>
</div>
<div class="row content-area-main">
<div class="col-md-8">
<div class="row">
<div class="col-md-6">
<img src="img/double-lily-modified3.png" alt="LilyPond logo">
</div>
<div class="col-md-6 header-info">
<h1 class="header-info-title">LilyPond</h1>
<p>... music notation for everyone</p>
</div>
</div>
<div class="row content-area-main">
<div class="col-md-12">
<p>LilyPond is a music engraving program, devoted to producing the highest-quality sheet music possible. It brings the aesthetics of traditionally engraved music to computer printouts. LilyPond is free software and part of the GNU Project.</p>
<p class="header-info-link">Read more in our Introduction!</p>
</div>
</div>
<div class="row content-area">
<div class="col-md-12">
<div class="card card-block">
<h4 class="card-title">Beatuiful Sheet Music</h4>
<img src="img/bwv861-lilypond.png" class="img-fluid img-thumbnail card-image-custom" width="100%">
<p class="card-text">LilyPond is a powerful and flexible tool for engraving tasks of all kinds, for example classical music (like the example above by J.S. Bach), complex notation, early music, modern music, tablature, vocal music, lead sheets, educational materials, large orchestral projects, customized output, and even Schenker graphs.</p>
<span class="card-link">Browse our gallery of Examples and be inspired!</span>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card card-block">
<h4 class="card-title">Stable Release</h4>
<ul class="list-group list-group-flush">
<li class="list-group-item">Download 2.18.2</li>
<li class="list-group-item">Manuals 2.18.2</li>
</ul>
</div>
<div class="card card-block">
<h4 class="card-title">Unstable Release</h4>
<ul class="list-group list-group-flush">
<li class="list-group-item">Download 2.19.51</li>
<li class="list-group-item">Manuals 2.19.51</li>
</ul>
</div>
<div class="card card-block">
<h4 class="card-title">Pondings</h4>
<p>The LilyPond Blog is up and running here! Anyone can follow and leave comments on the blog. To contribute, contact Urs Liska.</p>
</div>
</div>
</div>
Grid systems are used for creating page layouts through a series of
rows and columns that house your content. Use rows to create
horizontal groups of columns.
Bootstrap Grid System
Your .row clears the last .row. Try placing your content in the column you'd like it within the same .row.
I'm trying to implement a html tabbed interface. For some reason clicking on a tab will kick me back to the homepage instead of showing a new list of data. Do I need to add a url route to the <a href> ?
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">Overview</li>
<li role="presentation">Documents</li>
<li role="presentation">List</li>
</ul>
<div id="mainBody">
<div class="tab-content">
<div class="tab-pane active" id="overview">
<div role="tabpanel">
DATA 1
</div>
</div>
<div class="tab-pane" id="documents">
<div role="tabpanel">
DATA 2
</div>
</div>
<div class="tab-pane" id="punchlist">
<div role="tabpanel">
DATA 3
</div>
</div>
</div>
</div>
If you mean you are just trying to show the contents of the tab then I would change your href="#something" to href="javascript: return false;" or put the code in your event handler.
Tested this over on Bootply
http://www.bootply.com/DqUJfu6r4z
You simply need to close the quotations on your IDs:
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">Overview</li>
<li role="presentation">Documents</li>
<li role="presentation">List</li>
</ul>
<div id="mainBody">
<div class="tab-content">
<div class="tab-pane active" id="overview">
<div role="tabpanel">
DATA 1
</div>
</div>
<div class="tab-pane" id="documents">
<div role="tabpanel">
DATA 2
</div>
</div>
<div class="tab-pane" id="punchlist">
<div role="tabpanel">
DATA 3
</div>
</div>
</div>
</div>
I use bootstrap on my current project, it's working fine but only one glitch:
I have 3 col-sm-6 next to each other, when the second col-sm-6 is longer than the first, third col-sm-6 moves to left and a gap appears between first and third one.
I have 2 points to ask about:
Is it possible / how to remove that gap.
Is it possible / how to fix the third .col-sm-6 .tasks-panel to left.
Here is 2 images demonstrate what problem I have:
Second col-sm-6 is short:
Second col-sm-6 is longer than the first:
My html structure goes like this:
<h4><span data-head-year></span> <span data-head-month></span></h4>
<a class="pull-right" id="today"><div class="btn btn-primary" style="margin:3px">Today</div></a>
</div>
<hr style="margin: 20px 0"/>
<div class="day-headers">
<div class="day header">Mon</div>
<div class="day header">Tue</div>
<div class="day header">Wed</div>
<div class="day header">Thu</div>
<div class="day header">Fri</div>
<div class="day header">Sat</div>
<div class="day header">Sun</div>
</div>
<div class="days" data-group="days">
<!-- the place where days will be generated -->
</div>
</div>
<!-- Responsive calendar - END -->
</div>
Outlets to visit
<div class="template outlet-wrapper" style="display: none">
<div class="outlet-header">
<div class="col-xs-6">
<h4 class="outlet-name"></h4>
</div>
<div class="col-xs-6 text-right">
<h5 class="tools" style="display: none">
<i class="icon-repeat repeat"></i>
<span class="glyphicon glyphicon-remove remove"></span>
</h5>
</div>
</div>
<div class="clearfix"> </div>
<div class="outlet-body">
<div class="col-sm-6">
Time to reach: <spane class="time-to-reach"></spane>
</div>
<div class="col-sm-6">
Time to leave: <span class="time-to-leave"></span>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="panel-footer">
<button class="btn btn-primary pull-right" id="add-outlet"> Add Visit </button>
<div class="clearfix"></div>
</div>
</div>
Tasks List
</div>
<div class="panel-footer">Panel Footer</div>
</div>
Sorry for bad format, I don't know why stackoverflow editor breaks my html code; I have tried (Ctrl + K, <pre><code>) but none of them worked !
If you're interested in seeing my code properly, please show my post in editor.
Thanks in advanced.
Update:
A Codepen is available here, press add visit to see what happens if second column is long.
Have you tried to apply "pull-right" to the "col-sm-6" container of "panel panel-primary outlets-panel"?
<div class="col-sm-6 pull-right">
<div class="panel panel-primary outlets-panel">
<div class="panel-heading">
...
Forked Codepen
You'll still have to fix the above space of the "tasks list" container, but that should be trivial.