Initial Page Load Shows contents of both tabs - html

On initial load, the content from both tabs show on the webpage, once the tab is clicked for the first time they begin to work as expected.
Any ideas on why this is happening?
Here is my html
<div id="userFunctions" style="display: none;" >
<h2 id="welcome"></h2>
<button id="btnChangeUser" class="btn btn-primary" style="display: none;">Change User</button>
<br>
<hr>
<ul class="nav nav-tabs">
<li class="active"><a id="showSubs" data-toggle="tab" href="#subscriptionManagement">Subscription Portal</a></li>
<li><a id="showLocation" data-toggle="tab" href="#locationManagement">Location Management</a></li>
</ul>
<div class = tab-content>
<div id="subscriptionManagement" class="tab-pane fade in active">
<hr>
<section id="sendSubRequest">
<h4>Request Subscription</h4>
<div class="input-group">
<input type="text" id="subUserName" class="form-control "></input>
<span class="input-group-btn">
<button id="btnSubUser" class="btn btn-primary">Subscribe</button>
</span>
</div>
</section>
<br>
<section id="ReviewSubRequests">
<h4>Incoming Request(s)</h4>
<ul id='subscriptionsList'>
</ul>
</section>
</div>
<div id="locationManagement" class="tab-pane fade in active">
<hr>
<section id="cityDetails">
<section id="map">
</section>
<br>
<section>
<button id="btncheckInLocation" class="btn btn-primary">Check-In User location</button>
</section>
</section>
<section id="friendsList">
<h4>Subscribed Friends</h4>
<ul id='subscribedUsers'>
</ul>
</section>
</div>
</div>
</div>

Both your tabs (#subscriptionManagement and #locationManagement) have the active class, meaning they are both active by default. This class should be getting added on navigation, indicating that the content should be shown. You simply need to remove this class from the tab which you don't want to show on initial load:
Change:
<div id="locationManagement" class="tab-pane fade in active">
To:
<div id="locationManagement" class="tab-pane fade in">
Hope this helps! :)

Related

component not loading in angular 6

I am creating a project Where I have a homepage with a sidebar. On click of the sidebar, the component is supposed to be loaded on the right hand side of the page. I have done the routing for the same too. Can anyone help me?
<div class="container">
<div class="row">
<app-mentor-sidebar></app-mentor-sidebar>
<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
<div class="row">
<ol class="breadcrumb">
<li><a href="#" >
<em class="fa fa-home"></em>
</a></li>
<li class="active"><a [routerLink]="">Dashboard</a></li>
<li class="active"><a [routerLink]=""> {{breadcum}}
</a></li>
</ol>
</div>
<br>
<div class="row">
<div class="btn-group">
<button class="btn btn-primary" (click)=goback(); >Back</button>
</div>
<router-outlet> </router-outlet>
</div>
</div>
</div>
The is supposed to load the html component but nothing is happening.

Bootstrap row cannot fit all twelve columns

I am trying to understand how bootstrap lays out the divs and why my layout does not render as I expected it to.
I am attempting to use boostrap's grid system to layout out two divs of width 5 columns (w/ the pink background) with a div separating them of width 2 columns (the black line).
When the outermost div shrinks beyond a certain amount, the inner divs no longer all fit contiguously, as shown below. This is not due to the screen size suprassing one of the cuttoffs (i.e. going from medium to small).
Why does this happen? Isn't bootstrap supposed to make sure that the div's shrink proportionally to their column widths?
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="col-sm-12">
<div class="row">
<div class="col-sm-12 text-center filtersectionheader">
Course Level
</div>
</div>
<div class="row">
<!--Left div-->
<div class="col-sm-5" id="randompink">
<div class="row">
<div class="checkbox center-inner">
<label>
<input type="checkbox"> <small id="levelcheckboxtext">Minimum</small>
</label>
</div>
</div>
<div class="row">
<div class="dropdown center-inner">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">2000
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>HTML
</li>
<li>CSS
</li>
<li>JavaScript
</li>
</ul>
</div>
</div>
</div>
<!-- End of Left div-->
<!--Small Black Line-->
<div class="col-sm-2 top45" id="shorthline"></div>
<!--End of Small Black line-->
<!--Right div-->
<div class="col-sm-5" id="randompink">
<div class="row">
<div class="checkbox center-inner">
<label>
<input type="checkbox"><small id="levelcheckboxtext">Maximum</small>
</label>
</div>
</div>
<div class="row">
<div class="dropdown center-inner">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">2000
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>HTML
</li>
<li>CSS
</li>
<li>JavaScript
</li>
</ul>
</div>
</div>
</div>
<!--End of Right Div-->
</div>
</div>

Bootstrap tab for buttons?

I have a sign up page divided into two sections. I just want to show each section content hiding in current page when someone click these major buttons. The concept is similar to bootstrap tabs, but I'm not using tabs here. These are simple bootstrap buttons. I tried to play with bootstrap classes with my code but got no luck. I'm using meteor and react.
Screenshot for the image.
"Work and Hire Buttons"
And this is my code
<div id="signup-top-btn">
<div id="myTabs" role="tablist">
<div className="col-xs-6 signup-work-btn">
<button type="button" className="btn btn-block blue-btn active-btn"
data-toggle="tab"
>
Work
</button>
</div>
<div className="col-xs-6 signup-hire-btn">
<button type="button" className="btn btn-primary btn-block blue-btn"
data-toggle="tab" data-target="#employer-signup"
>
Hire
</button>
</div>
</div>
</div>
Any idea?
Make use of the Bootstrap tabs, and style those like:
<!-- Nav tabs -->
<ul class="nav" role="tablist">
<li role="presentation" class="active">Work</li>
<li role="presentation">Hire</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="work">...my working tab</div>
<div role="tabpanel" class="tab-pane" id="hire">...my hiring tab</div>
</div>
Bootply: http://www.bootply.com/CrAGi1Btxj
You can always use JavaScript:
$('button[data-toggle="tab"]').on('click', function(e){
e.preventDefault();
$('.nav-tabs').find('a[href="' + $(this).data('target') + '"]').click();
});

html tabs kick back to home page instead of showing new data

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>

Data-toggle with Flask & Jinja template

I have some html that is rendered by Flask. I have three navigation tabs that the user can click on to see different panels. This is the relevant code:
<div class="tabbable">
<!-- Only required for left/right tabs -->
<ul class="nav nav-tabs">
<li class="active">Pick Colors
</li>
<li>Add Text
</li>
<li>Add Logos
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<div class="well">
<ul class="nav">
<li class="color-preview" title="White" style="background-color:#ffffff;"></li>
</ul>
</div>
</div>
<div class="tab-pane" id="tab2">
<div class="well">
<div class="input-append">
<input class="span2" id="text-string" type="text" placeholder="add text here...">
<button id="add-text" class="btn" title="Add text"><i class="icon-share-alt"></i>
</button>
<hr>
</div>
</div>
</div>
<div class="tab-pane" id="tab3">
<div id="avatarlist">
<img style="cursor:pointer;" class="img-polaroid" src="static/img/img1.png">
</div>
</div>
</div>
When I open the HTML file by itself, I can click on the different tabs and get the relevant tab-pane's to open up. When the page is rendered by Flask though, I'm unable to get the functionality to work. Clicking the tabs doesn't do anything. What am I doing wrong?
I understand Flask uses Jinja templates so I must not be understanding that properly, but I'm not sure how to fix it. Thanks in advance for your help.
I just fixed it. The issue was that
<li>Add Text
</li>
<li>Add Logos
Should've said data-toggle="tab" instead of tab#.