Select default tab on page load - javascript

I would like the first tab to be 'selected' upon page load.
Hi, I would like the first tab, 'Discover', to be selected upon page load. I have run multiple versions of the same code functionality in Javascript and nothing seems to be working. I am wondering whether my code format in Javascript or HTML is correct.
I have used this as a reference: https://codepen.io/PeteTalksWeb/pen/vmyJBd
Any feedback or help on this subject would be much appreciated, thanks in advance.
<div id="tabs" class="tabbable-line">
<ul class="nav nav-tabs text-center">
<li class="active">
Discover
</li>
<li>
Planning
</li>
<li>
Marketing
</li>
<li>
Growth
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabs-1">
<div class="col-md-6 margin-btm-30">
<img src="img/process-1.jpg" class="img-responsive img-shadow" alt="">
</div>
<div class="col-md-6">
<h4>Integration of business</h4>
<p>Some text</p>
</div>
</div>
<div class="tab-pane" id="tabs-2">
<div class="col-md-6 margin-btm-30">
<img src="img/process-2.jpg" class="img-responsive img-shadow" alt="">
</div>
<div class="col-md-6">
<h4>Integration of business</h4>
<p>Some text</p>
</div>
</div>
<div class="tab-pane" id="tabs-3">
<div class="col-md-6 margin-btm-30">
<img src="img/process-3.jpg" class="img-responsive img-shadow" alt="">
</div>
<div class="col-md-6">
<h4>Integration of business</h4>
<p>Some text</p>
</div>
</div>
<div class="tab-pane" id="tabs-4">
<div class="col-md-6 margin-btm-30">
<img src="img/process-4.jpg" class="img-responsive img-shadow" alt="">
</div>
<div class="col-md-6">
<h4>Integration of business</h4>
<p>Some text</p>
</div>
</div>
</div>
</div>
<div id="tabid"></div>
<script>
$("#tabs").tabs({
active: 0,
activate: function (event, ui) {
var active = $('#tabs').tabs('option', 'active');
}
});
</script>
I expected the tab/link to be selected upon page load, but the output instead was that the tab 'flashed' as if selected and faded shortly after.
EDIT
I received this error:
Uncaught TypeError: $(...).tabs is not a function
What does this mean?

The code snippet below shows that it is working fine. Please check the following:
Your javascript is wrapped with a document.ready function: Either
$(function(){
or
$(document).ready(function(){
(both work the same - see the below StackSnippet for how the first was used)
You have included all necessary libraries (the CSS, the jQuery.js and the jQueryUI.js files) -- as in the below snippet. You can include these just as they are within the <head> tags of your page.
$(function(){
$("#tabs").tabs({
active: 0,
activate: function (event, ui) {
var active = $('#tabs').tabs('option', 'active');
}
});
}); //end document.ready
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css" >
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div id="tabs" class="tabbable-line">
<ul class="nav nav-tabs text-center">
<li class="active">
Discover
</li>
<li>
Planning
</li>
<li>
Marketing
</li>
<li>
Growth
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabs-1">
<div class="col-md-6 margin-btm-30">
<img src="img/process-1.jpg" class="img-responsive img-shadow" alt="">
</div>
<div class="col-md-6">
<h4>Integration of business</h4>
<p>Some text</p>
</div>
</div>
<div class="tab-pane" id="tabs-2">
<div class="col-md-6 margin-btm-30">
<img src="img/process-2.jpg" class="img-responsive img-shadow" alt="">
</div>
<div class="col-md-6">
<h4>Integration of business</h4>
<p>Some text</p>
</div>
</div>
<div class="tab-pane" id="tabs-3">
<div class="col-md-6 margin-btm-30">
<img src="img/process-3.jpg" class="img-responsive img-shadow" alt="">
</div>
<div class="col-md-6">
<h4>Integration of business</h4>
<p>Some text</p>
</div>
</div>
<div class="tab-pane" id="tabs-4">
<div class="col-md-6 margin-btm-30">
<img src="img/process-4.jpg" class="img-responsive img-shadow" alt="">
</div>
<div class="col-md-6">
<h4>Integration of business</h4>
<p>Some text</p>
</div>
</div>
</div>
</div>
<div id="tabid"></div>
<script>
</script>

I have taken your code and created a JSFiddle with it here.
{note to moderator - not re-including code already in the question]
Your code works fine and as you will see I have been sure to include both the the following resources;
Jquery itself - https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js
Jquery UI - https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js
In my example change the following;
active: 1,
to
active: 0,
and you will see that a different tab is selected.
Good luck

Related

Owl Carousel change content of the element on click

I have a problem with owl carousel and till now I don't have any ideas how to fix it.
So on the image 1 you can see the normal behaviour of the slider. On the second one you will see the extended functionality of it. The idea is very simple, when user click on the element, he should expand it, but when the element is expanded all other element goes to 2 rows and I don't want to happen.
Image 1
Image 2
also Source code of one element
<div class="element box-shadow">
<div class="child">
<div class="row">
<div class="col-xs-12 col-md-8">
<span>05.</span>
<h3>Graphic Designer</h3>
<p class="inventive">Inventive Studio</p>
<p class="view-more">View more <img src="assets/images/view-more.svg" /></p>
</div>
<div class="col-xs-12 col-md-4 portfolio-image" >
<img src="assets/images/inventive-small-img.png" />
</div>
</div>
</div>
<div class="parent hidden">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="row">
<div class="col-xs-12 col-md-8">
<div class="row " style="margin-bottom: 15px;" >
<div class="col-xs-12 col-md-3">
<img src="assets/images/inventive-small-img.png" style="width:34px" class="rounded-circle">
</div>
<div class="col-xs-12 col-md-9 text no-padding" >
<h3>Graphic Designer</h3>
<p class="inventive">Inventive Studio</p>
</div>
</div>
</div>
<div class="col-xs-12 col-md-4 social-el" style="padding-left:0;">
<div class="stars">
<img class="mr-2" src="assets/images/full_star.svg" />
<img class="mr-2" src="assets/images/full_star.svg" />
<img class="mr-2" src="assets/images/half_star.svg" />
<img class="mr-2" src="assets/images/empty_star.svg" />
<img src="assets/images/empty_star.svg" />
</div>
</div>
</div>
<img src="assets/images/inventive-studio-img.png" class="img-fluid">
<div class="content">
<p >Designing and producing catalogs, sales sheets, proposals, scenario illustrations, brochures, posters, custom displays for trade shows and in-house exhibits and all others items.</p>
<div class="row">
<div class="col-xs-12 col-md-6">
<a class="view-less" href="#"><img src="assets/images/view-more.svg"/> View Less</a>
</div>
<div class="col-xs-12 col-md-6">
<div class="stars">
<img src="assets/images/Facebook.svg"/>
<img class="mr-10" src="assets/images/twitter.svg"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
also will share and jquery code
$(".owl-carousel").owlCarousel({
margin:10,
loop: true,
autoWidth: true,
items:3,
rewind: true,
autoplay: true,
responsiveClass:true,
});
$('.work').each(function(i, el) {
$parent = $(el);
$('.element', $parent).each(function(i, item) {
$element = $(item)
$element.on('click', function(e) {
$current = $(this)
console.log($current)
if ($('.parent', $current).hasClass('hidden')) {
$('.parent', $current).removeClass('hidden');
$current.addClass('expand-element');
$current.css('border-radius', 10)
$('.child', $current).addClass('hidden');
} else {
$current.removeClass('expand-element');
$('.parent', $current).removeClass('visible').addClass('hidden');
$current.css('border-radius', 20)
$('.child', $current).removeClass('hidden');
}
})
})
})

showing new html codes using javascript and divstyles

I have a message page which shows your current messages. But the problem is that, it shows only one message, and that's the "newest" message. And the first messagebar which I click it, it won't show the HTML Code, even if it removes the "No mail Selected"
Here's how it sees if I press at second message tab: https://i.imgur.com/hMjftkm.png
My problem is that, the first messagetab it won't show it's HTML code. And when I change the message tabs (clicking new one) it won't actualise the new code. It shows the same code layout.
I found that error is in javascript, at the MAILCONTENT (1 or 2), but i have no clue how to fix it
JavaScript
<script>
$(document).ready(function() {
$('.emailcontent input[type=checkbox]').click(function() {
if($(this).is(':checked')) {
$(this).closest('.list-group-item').addClass('selected');
} else {
$(this).closest('.list-group-item').removeClass('selected');
}
});
// Clicking a message
$('.list-group-item > .media').click(function() {
$('.list-group-item').each(function() {
$(this).removeClass('active');
});
$(this).parent().addClass('active').removeClass('unread');
$('.nomail').addClass('hide');
$('.mailcontent').removeClass('hide');
});
$('.list-group-item > .media2').click(function() {
$('.list-group-item').each(function() {
$(this).removeClass('active');
});
$(this).parent().addClass('active').removeClass('unread');
$('.nomail2').addClass('hide');
$('.mailcontent').removeClass('hide');
});
});
</script>
HTML
<div class="mainpanel">
<div class="emailcontent">
<div class="email-options">
<label class="ckbox">
</label>
</div><!-- email-options -->
<div class="list-group">
<div class="list-group-item unread">
<div class="list-left">
<label class="ckbox">
</label>
</div>
<div class="media">
<div class="media-left">
<img class="media-object img-circle" src="../images/photos/user1.png" alt="">
</div>
<div class="media-body">
<span class="pull-right">1 hour ago</span>
<h5 class="media-heading">Sendername1</h5>
<h5>Title1</h5>
</div>
<p>Hi. There's something wri..</p>
</div>
</div>
<div class="list-group-item unread">
<div class="list-left">
<label class="ckbox">
</label>
</div>
<div class="media2">
<div class="media-left">
<img class="media-object img-circle" src="../images/photos/user1.png" alt="">
</div>
<div class="media-body">
<span class="pull-right">1 hour ago</span>
<h5 class="media-heading">Sendername2</h5>
<h5>Title2</h5>
</div>
<p>That's title2 that means yo...</p>
</div>
</div>
</div><!-- emailcontent -->
<div class="contentpanel emailpanel">
<h3 class="nomail">No mail selected</h3>
<div class="mailcontent hide">
<div class="email-header">
<div class="pull-right">
2 hour ago
</div>
<div class="media">
<div class="media-left">
<a href="#">
<img class="media-object img-circle" src="../images/photos/user1.png" alt="">
</a>
</div>
<div class="media-body">
<h4 class="media-heading">Sendername1</h4>
to: me
</div>
</div><!-- media -->
</div><!-- email-header -->
<hr>
<h3 class="email-subject">MESSAGE1</h3>
<div class="email-body">
<p>Text1</p>
</div><!-- mailcontent -->
</div><!-- contentpanel --><!-- mailcontent -->
<div class="contentpanel emailpanel">
<h3 class="nomail">No mail selected</h3>
<div class="mailcontent hide">
<div class="email-header">
<div class="pull-right">
2 hour ago
</div>
<div class="media2">
<div class="media-left">
<a href="#">
<img class="media-object img-circle" src="../images/photos/user1.png" alt="">
</a>
</div>
<div class="media-body">
<h4 class="media-heading">Title2</h4>
to: me
</div>
</div><!-- media -->
</div><!-- email-header -->
<hr>
<h3 class="email-subject">MESSAGE2</h3>
<div class="email-body">
<p>That's message 2</p>
</div><!-- mailcontent -->
</div><!-- contentpanel --><!-- mailcontent -->
</div><!-- mainpanel -->
</div><!-- mainpanel -->
</div><!-- emailcontent -->
</div>
</div>
CODEPEN
https://codepen.io/anon/pen/KxGjWp
First: may be you should redesign your code little bit.
But if you just want it working as it is, here is solution:
html:
<div class="mainpanel">
<div class="emailcontent">
<div class="email-options">
<label class="ckbox">
</label>
</div><!-- email-options -->
<div class="list-group">
<div class="list-group-item unread">
<div class="list-left">
<label class="ckbox">
</label>
</div>
<div class="media">
<div class="media-left">
<img class="media-object img-circle" src="../images/photos/user1.png" alt="">
</div>
<div class="media-body">
<span class="pull-right">1 hour ago</span>
<h5 class="media-heading">Sendername</h5>
<h5>Title!</h5>
</div>
<p>This is messagebar1. Clicking it will show TITLE1.</p>
</div>
</div>
<div class="list-group-item unread">
<div class="list-left">
<label class="ckbox">
</label>
</div>
<div class="media2">
<div class="media-left">
<img class="media-object img-circle" src="../images/photos/user1.png" alt="">
</div>
<div class="media-body">
<span class="pull-right">1 hour ago</span>
<h5 class="media-heading">sendername2</h5>
<h5>Title2</h5>
</div>
<p>This is messagebar2. Clicking it will show TITLE2</p>
</div>
</div>
</div><!-- emailcontent -->
<div class="contentpanel emailpanel">
<h3 class="nomail">No mail selected</h3>
<div class="mailcontent hide">
<div class="email-header">
<div class="pull-right">
2 hour ago
</div>
<div class="media2">
<div class="media-left">
<a href="#">
<img class="media-object img-circle" src="../images/photos/user1.png" alt="">
</a>
</div>
<div class="media-body">
<h4 class="media-heading">SENDER1</h4>
to: me
</div>
</div><!-- media -->
</div><!-- email-header -->
<hr>
<h3 class="email-subject">TITLE1</h3>
<div class="email-body">
<p>So this should be message1</p>
</div>
<br>
<hr>
</div><!-- mailcontent -->
<div class="mailcontent2 hide">
<div class="email-header">
<div class="pull-right">
2 hour ago
</div>
<div class="media2">
<div class="media-left">
<a href="#">
<img class="media-object img-circle" src="../images/photos/user1.png" alt="">
</a>
</div>
<div class="media-body">
<h4 class="media-heading">sendername2</h4>
to: me
</div>
</div><!-- media -->
</div><!-- email-header -->
<hr>
<h3 class="email-subject">TITLE 2</h3>
<div class="email-body">
<p>So there is message2 layout. But if I click messagebar1 it won't show it's content and delete this or vice-versa</p>
</div>
</div><!-- mailcontent -->
</div><!-- mainpanel -->
</div><!-- mainpanel -->
javascript:
$(document).ready(function() {
$('.emailcontent input[type=checkbox]').click(function() {
if($(this).is(':checked')) {
$(this).closest('.list-group-item').addClass('selected');
} else {
$(this).closest('.list-group-item').removeClass('selected');
}
});
// Clicking a message
$('.list-group-item > .media').click(function() {
$('.list-group-item').each(function() {
$(this).removeClass('active');
});
$(this).parent().addClass('active').removeClass('unread');
$('.nomail').addClass('hide');
$('.mailcontent').removeClass('hide');
$('.mailcontent2').addClass('hide');
});
$('.list-group-item > .media2').click(function() {
$('.list-group-item').each(function() {
$(this).removeClass('active');
});
$(this).parent().addClass('active').removeClass('unread');
$('.nomail').addClass('hide');
$('.mailcontent2').removeClass('hide');
$('.mailcontent').addClass('hide');
});
});
So problem was that even when you hiding mailcontent2, its wrapper div is still visible and mailcontent is visible but under that empty div. I moved both mailcontent under same container div. I would suggest to you on load create an array of object that contains messages and assign to each left panel menu item id that is same as array index of that message, then you can have only one mailcontent and just assign different text to it from array.
Also use dev console in browser (usually F12) there you can hover over element and see its dimensions and location, so it was visible that second mail container is over the first one. Also there you can disable, enable and edit css fast and run javascript commands, so you can compose suitable style and see right away how it will look.

Bootstrap Vertical Tabs auto change

I have some vertical tabs that change the content in a box.
I would like these tab to auto change by themselves and cant seem to get it to work.
Here is my code:
<div class="media">
<div class="parrent pull-left">
<ul class="nav nav-tabs nav-stacked">
<li class="">Architect</li>
<li class="">AIA</li>
<li class="">IRS </li>
<li class="">AKIN GUMP</li>
<li class="">PWC</li>
<li class="">EPA</li>
</ul>
</div>
<div class="parrent media-body">
<div class="tab-content">
<div class="tab-pane fade" id="tab1">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/R&D.png">
</div>
<div class="media-body">
<h2>Architect Magazine</h2>
<p>It’s hard to get simpler in conception and execution than Green-Zip Tape. The product is a substitute for the joint-compound tape that has been used between gypsum board panels since the introduction of prefabricated plasterboard in the early 1930s. The product impressed all three jurors.</p>
</div>
</div>
</div>
<div class="tab-pane fade active in" id="tab2">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/AIA.png">
</div>
<div class="media-body">
<h2>AIA Awards</h2>
<p>This patented demountable tape provides an alternative method for hanging sheetrock for future de-construction and reuse.
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab3">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/IRS.png">
</div>
<div class="media-body">
<h2>IRS Awards</h2>
<p>Taxpayer's Zip type partitions installed within the Owned Property and Leased Property are included in asset class 57.0 of Rev. Proc. 87-56 for purposes of § 168.
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab4">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/AkinGump.png">
</div>
<div class="media-body">
<h2>Akin Gump Awards</h2>
<p style="font-size: 12px;">The article analyzes an IRS ruling that says that zip system drywall is eligible for more favorable depreciation than conventional system drywall, despite the fact that each serves the same purpose and has a comparable cost. Burton also looks at the opportunities this creates for real estate developers and the implications for certain nontraditional real estate investment trusts.
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab5">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/PWC.png">
</div>
<div class="media-body">
<h2>PWC Awards</h2>
<p style="font-size: 12px;">IRS rules on the depreciation classification of certain interior, nonloadbearing partitions
The IRS, in PLR 201404001, ruled that zip-type partitions installed within owned andleased property must be included in asset class 57.0 of Rev. Proc. 87-56 under Section 168, and that conventional drywall partitions are classified as non-residential real property under Section 168(e)(2)(B).
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab6">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/US.png">
</div>
<div class="media-body">
<h2>EPA Awards</h2>
<p>Winner: Green-Zip-TapeTM Demountable Tape Drywall tape attachment system to support easy deconstruction and reuse
</p>
</div>
</div>
</div>
</div>
<!--/.tab-content-->
</div>
<!--/.media-body-->
</div>
<!--/.media-->
Please anything would help!
As you can see as the user clicks on the tabs on the left the content to the right changes. I would like to cycle through the tabs at 5 second intervals.
Thanks!
Here is the second box:
<div class="col-xs-12 col-sm-6 wow fadeInDown">
<div class="tab-wrap">
<div class="media">
<div class="parrent pull-left">
<ul class="nav nav-tabs nav-stacked">
<li class="">Marek</li>
<li class="">Ozarks Bank</li>
<li class="">CBRE </li>
<li class="">Habitat</li>
<li class="">Huffman</li>
<li class="">Holiday</li>
</ul>
</div>
<div class="parrent media-body">
<div class="tab-content">
<div class="tab-pane fade" id="tab7">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Referals/MarekBrothers.jpg">
Click for Referance
</div>
<div class="media-body">
<h2>Marek</h2>
<p>We recently built our new 50,000 SF headquarters building and used the Green-Zip Partition System everywhere. To me, it’s a simple solution and one that everyone should take advantage of!
<br>
-<b>R. Stan Marek</b> / Chairman
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab8">
<div class="media">
<div class="pull-left boxImg" style="margin-top: 20px;">
<img class="img-responsive" src="images/Referals/BankOfTheOzarks.jpg" style="margin-top: 30px;">
Click for Referance
</div>
<div class="media-body">
<h2>Bank Of The Ozarks</h2>
<p>….we now have a built in mechanism for remodeling that should be less expensive, less time consuming, and most importantly, environmentally friendly. <br>
-<b>Mark D. Ross</b> / Vice-Chairman & COO
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab9">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Referals/CBRE.jpg">
Click for Referance
</div>
<div class="media-body">
<h2>CBRE</h2>
<p>….there is no reason not to consider Green Zip Tape as shorter-life property for any tax payer especially based on the design intent, which was originally based on the reusable concept.
<br>
-<b>Matt Rader</b> / National Managing Director
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab10">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Referals/Habitat.jpg">
Click for Referance
</div>
<div class="media-body">
<h2>Habitat for Humanity</h2>
<p>I am very excited about the opportunity to help others have affordable and decent housing, while also keeping more products that can be reused from piling up in a local landfill. Now that is a winning combination!
<br>
-<b>Ron Collins</b> / Vice President of ReStores
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab11">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Referals/Huffman.jpg">
Click for Referance
</div>
<div class="media-body">
<h2>Huffman Drywall</h2>
<p>In addition to the sustainable benefits, the financial benefits associated with accelerated depreciation are valuable to me as an owner, and could potentially add to the building’s value in the event of a sale.
<br>
-<b>Brandon Huffman</b> / President
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab12">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Referals/Holiday.jpg">
Click for Referance
</div>
<div class="media-body">
<h2>Holiday Inn</h2>
<p>We found that the system will be acceptable for use in Holiday Inn, Holiday Inn Express hotels, and Staybridge Suites hotels. Congratulations.
<br>
-<b>Scott Bruce</b>
</p>
</div>
</div>
</div>
</div>
<!--/.tab-content-->
</div>
<!--/.media-body-->
</div>
<!--/.media-->
</div>
<!--/.tab-wrap-->
</div>
<!--/.col-sm-6-->
I'm not sure what triggers the change for you, but if it's the "active" class that's applied to the <li> element, then this should work for you:
jQuery:
var cycle = {
onReady: function() {
$(".nav-stacked li:first").addClass("active in");
$("#tab1").addClass("active in");
setInterval(function() {
var $navStacked = $("li.active");
var tabContent = $("li.active a").attr("href");
if ($navStacked.is(".nav-stacked li:last-child")) {
$navStacked.removeClass("active in");
$(".nav-stacked li:first").addClass("active in");
$("div " + tabContent).removeClass("active in");
$("div#tab1").addClass("active in");
} else {
$navStacked.removeClass("active in").next().addClass("active in");
$("div " + tabContent).removeClass("active in").next().addClass("active in");
}
}, 5000);
}
};
$(document).ready(cycle.onReady);
HTML:
<div class="media">
<div class="parrent pull-left">
<ul class="nav nav-tabs nav-stacked">
<li class="">Architect</li>
<li class="">AIA</li>
<li class="">IRS </li>
<li class="">AKIN GUMP</li>
<li class="">PWC</li>
<li class="">EPA</li>
</ul>
</div>
<div class="parrent media-body">
<div class="tab-content">
<div class="tab-pane fade" id="tab1">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/R&D.png">
</div>
<div class="media-body">
<h2>Architect Magazine</h2>
<p>It’s hard to get simpler in conception and execution than Green-Zip Tape. The product is a substitute for the joint-compound tape that has been used between gypsum board panels since the introduction of prefabricated plasterboard in the early
1930s. The product impressed all three jurors.</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab2">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/AIA.png">
</div>
<div class="media-body">
<h2>AIA Awards</h2>
<p>This patented demountable tape provides an alternative method for hanging sheetrock for future de-construction and reuse.
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab3">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/IRS.png">
</div>
<div class="media-body">
<h2>IRS Awards</h2>
<p>Taxpayer's Zip type partitions installed within the Owned Property and Leased Property are included in asset class 57.0 of Rev. Proc. 87-56 for purposes of § 168.
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab4">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/AkinGump.png">
</div>
<div class="media-body">
<h2>Akin Gump Awards</h2>
<p style="font-size: 12px;">The article analyzes an IRS ruling that says that zip system drywall is eligible for more favorable depreciation than conventional system drywall, despite the fact that each serves the same purpose and has a comparable cost. Burton also looks
at the opportunities this creates for real estate developers and the implications for certain nontraditional real estate investment trusts.
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab5">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/PWC.png">
</div>
<div class="media-body">
<h2>PWC Awards</h2>
<p style="font-size: 12px;">IRS rules on the depreciation classification of certain interior, nonloadbearing partitions The IRS, in PLR 201404001, ruled that zip-type partitions installed within owned andleased property must be included in asset class 57.0 of Rev. Proc.
87-56 under Section 168, and that conventional drywall partitions are classified as non-residential real property under Section 168(e)(2)(B).
</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab6">
<div class="media">
<div class="pull-left boxImg">
<img class="img-responsive" src="images/Awards/US.png">
</div>
<div class="media-body">
<h2>EPA Awards</h2>
<p>Winner: Green-Zip-TapeTM Demountable Tape Drywall tape attachment system to support easy deconstruction and reuse
</p>
</div>
</div>
</div>
</div>
<!--/.tab-content-->
</div>
<!--/.media-body-->
</div>
<!--/.media-->
CodePen

Mixitup filter disappears and adds "fail" class

In my mixitup, i am doing a basic filter but when i click one of the filter buttons, filtered items comes and disappears after a second. I can see in firebug, it adds “fail” class to the container of these items. But i can’t see what kind of error is that.
In codepen: http://codepen.io/anon/pen/PPOgwr
Here is my HTML for filter buttons:
<div class="row row-centered filter-section">
<div class="col-md-7 col-centered">
<ul class="filter">
<li>Hepsi</li>
<li>/</li>
<li>Basılı İş</li>
<li>/</li>
<li>Kurumsal Kimlik</li>
<li>/</li>
<li>İlan</li>
<li>/</li>
<li>Ambalaj</li>
<li>/</li>
<li>Stand</li>
<li>/</li>
<li>Film</li>
</ul>
</div>
</div>
Here is the container:
<div class="row grid" id="grid">
<div class="col-md-3 col-sm-6 margin-bottom-30 mix basili">
<div class="position-relative">
<a href="" id="silver1">
<img class="img-responsive" src="isler/silver/silver1.jpg" alt="portfolio">
<div class="overlay">
<div class="portfolio-title text-center">
<h4 class="font-nixie">SILVER DÖKÜM DEMİR KATALOG</h4>
</div>
</div> <!-- /overlay -->
</a>
</div>
</div>
<div class="col-md-3 col-sm-6 margin-bottom-30 mix basili">
<div class="position-relative">
<a href="" id="silver2">
<img class="img-responsive" src="isler/silver/silver3.jpg" alt="portfolio">
<div class="overlay">
<div class="portfolio-title text-center">
<h4 class="font-nixie">SILVER DÖKÜM DEMİR KATALOG</h4>
</div>
</div> <!-- /overlay -->
</a>
</div>
</div>
<div class="col-md-3 col-sm-6 margin-bottom-30 mix ilan">
<div class="position-relative">
<a href="" id="silver3">
<img class="img-responsive" src="isler/silver/silver4.jpg" alt="portfolio">
<div class="overlay">
<div class="portfolio-title text-center">
<h4 class="font-nixie">SILVER DÖKÜM DEMİR KATALOG</h4>
</div>
</div> <!-- /overlay -->
</a>
</div>
</div>
</div>
JS code:
$('#grid').mixItUp();
$('.filter-section').on( 'click', 'a.filter', function() {
var filterValue = $(this).attr('data-filter');
$('#grid').mixItUp('filter', filterValue, false);
$('#grid').on('mixFail', function(e, state){
console.log(state);
});
});
I need your helps
It's probably a bit late to give you an answer on this, but I ran into a similar problem and as part of that I managed to sort yours, too.
To cut it short, your issue is that you applied the 'filter' class on the <ul> as well as the <li> tags. Removing the class from <ul> in the CodePen you provided solves the issue - although messes up your layout.
Hope this helps.

Click function that opens and closes

I am trying to code something like this one on http://teamgeek.co.za/#who
I already had the code on the gif and div that will show the description on the bottom of each picture selected. The problem is that if I clicked on the second row, the opened description on the first row won't automatically close itself.
Here is my script that I used.
<script>
$("#items a").click(function() {
var id = $(this).attr("id");
$("#pages div#" + id + "").toggle("slow").siblings().hide("slow");
});
</script>
<script>
$("#items2 a").click(function() {
var id = $(this).attr("id");
$("#pages2 div#" + id + "").toggle("slow").siblings().hide("slow");
});
</script>
This is the full code that I used, and I am using the javascript above to get the functions:
<!-- Team Grid --><section class="main">
<div id="items">
<div class="item">
<a id="1" class="work">
<img class="media" src="img/tryimages/greggy.png"/>
<div class="content">
<img class="media" src="img/tryimages/greggy.gif"/>
<!--<h2 class="title">Click</h2>!-->
</div>
</a>
</div>
<div class="item">
<a id="2" class="work page-scroll">
<img class="media" src="img/tryimages/dennise.png"/>
<div class="content">
<img class="media" src="img/tryimages/dennise.gif"/>
</div>
</a>
</div>
<div class="item">
<a id="3" class="work page-scroll">
<img class="media" src="img/tryimages/jm.png"/>
<div class="content">
<img class="media" src="img/tryimages/jm.gif"/>
</div>
</a>
</div>
<div class="item">
<a id="4" class="work page-scroll">
<img class="media" src="img/tryimages/hannah.png"/>
<div class="content">
<img class="media" src="img/tryimages/hannah.gif"/>
</div>
</a>
</div>
</div>
</section><!-- End of Works Grid -->
<div id="pages">
<div id="1" class="mydivhide">
<h1>Greggy Rick Go</h1><h4>/Chief Executive Officer</h4>
</div>
<div id="2" class="mydivhide">
<h1>Dennise Recuerdo</h1><h4>/Secretary</h4>
</div>
<div id="3" class="mydivhide">
<h1>Jude Marlon Alegro</h1><h4>/Head Web Developer</h4>
</div>
<div id="4" class="mydivhide">
<h1>Hannah Lois Aliposa</h1><h4>/Head Content Writer</h4>
</div>
</div>
<!-- Team Grid --><section class="main">
<div id="items2">
<div class="item">
<a id="5" class="work page-scroll">
<img class="media" src="img/tryimages/rd.png"/>
<div class="content">
<img class="media" src="img/tryimages/rd.gif"/>
</div>
</a>
</div>
<div class="item">
<a id="6" class="work page-scroll">
<img class="media" src="img/tryimages/soc.png"/>
<div class="content">
<img class="media" src="img/tryimages/soc.gif"/>
</div>
</a>
</div>
<div class="item">
<a id="7" class="work page-scroll">
<img class="media" src="img/tryimages/anj.png"/>
<div class="content">
<img class="media" src="img/tryimages/anj.gif"/>
</div>
</a>
</div>
<div class="item">
<a id="8" class="work page-scroll">
<img class="media" src="img/tryimages/ian.png"/>
<div class="content">
<img class="media" src="img/tryimages/ian.gif"/>
</div>
</a>
</div>
</div>
</section><!-- End of Works Grid -->
<div id="pages2">
<div id="5" class="mydivhide">
<h1>Ruth Danielle Aliposa</h1><h4>/Head Web Designer</h4>
</div>
<div id="6" class="mydivhide">
<h1>Christopher Emmanuel Socong</h1><h4>/Web Developer</h4>
</div>
<div id="7" class="mydivhide">
<h1>Angineth Bantiles</h1><h4>/Web Content Writer</h4>
</div>
<div id="8" class="mydivhide">
<h1>Ian Kevin Mendova</h1><h4>/Web Developer</h4>
</div>
</div>
</div>
</section>
If you want to go with this code you should maybe use this:
<script>
$("#items a").click(function() {
var id = $(this).attr("id");
$("#pages div, #pages2 div").siblings().hide("slow");
$("#pages div#" + id + "").toggle("slow");
});
</script>
I'm not sure if I understand the snippet correctly since I don't know the rest of your code :-)
However, this isn't a good way to solve your issue. As in the comments already mentioned, it's a lot better to handle it with classes.
Here is a jsfiddle which can easily solve your problem:
JSFiddle
However you might only change the effect, but this is a minor thing.
Below code optimization of toggle for your issue
you have set class as .row-data for each row and the and write below script..
<script>
$(".row-data a").click(function() {
$(".row-data").hide("slow");
$(this).parent().show("slow");
});
</script>
Note: remove your Script...

Categories

Resources