Code for multiple tabs on my page (displaying these tabs and content dynamically):
jQuery('.tab-block li a').click(function() {
var theitem = jQuery(this);
theitem.parent().parent().find("li").removeClass("active");
theitem.parent().addClass("active");
theitem.parent().parent().parent().parent().find(".tab-content > ul > li").removeClass("active");
theitem.parent().parent().parent().parent().find(".tab-content > ul > li").eq(theitem.parent().index()).addClass("active");
return false;
});
Code in my HTML to display tabs:
<div class="tab-block">
<div class="tabs">
<ul>
<li class="active">TAB 1</li>
<li>TAB 2</li>
</ul>
<div class="clear-float"></div>
</div>
<div class="tab-content">
<ul>
<li class="active">
<p><h3>Goole.com</h3></a>
<p>Content</p>
</li>
<li>
<p><h3>Goole.com</h3></a>
<p>Content</p>
</li>
</ul>
</div>
</div>
Now all tabs work great but no links will open (the H3 link within the tabs themselves). Any ideas what I'm doing wrong?
Thank you.
I don't know what your specific problem is, you may want to provide a link to a jsfiddle, to make yourself clear, but if you need tabs, try EZ tabs jQuery plugin.
HTML:
<div class="tab-block">
<div class="tabs">
<ul class='nav'>
<li>TAB 1</li>
<li>TAB 2</li>
</ul>
<div class="clear-float"></div>
</div>
<div class="tab-content">
<div class='box'>
<p>
<h3>Goole.com</h3>
</a>
<p>Content</p>
</div>
<div class='box'>
<p>
<h3>Goole.com</h3>
</a>
<p>Content</p>
</div>
</div>
</div>
jQuery, on document ready:
$('.tab-block').eztabs({
tabsList : 'ul.nav',
animation: 'slideLeftRight',
boxContainer: '.tab-content',
animationTime: 200
});
jsfiddle
Related
I have to include an HTML menu.
I need to edit the active page from the css menu.
include menu:
<div w3-include-html="inc/header.html"></div>
/*CSS example - but not working:*/
.main-menu a.active {
color: #0061bb;
}
<div class="mnmenu-sec">
<div class="container">
<div class="row">
<div class="col-md-12 nav-menu">
<div class="col-md-3">
<div class="logo">
<img src="img/logo.png" alt="" />
</div>
</div>
<div class="col-md-9">
<div class="menu">
<nav id="main-menu" class="main-menu">
<ul>
<li>menu 1</li>
<li>menu 2</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
I need to highlight an active page from the menu, such as changing the font color.
Can you tell me how I could do it?
.main-menu a {
color: #000;
transition: 0.3s;
}
.main-menu a:hover {
color: #0061bb;
}
<div class="mnmenu-sec">
<div class="container">
<div class="row">
<div class="col-md-12 nav-menu">
<div class="col-md-3">
<div class="logo">
<img src="img/logo.png" alt=""/>
</div>
</div>
<div class="col-md-9">
<div class="menu">
<nav id="main-menu" class="main-menu">
<ul>
<li>menu 1</li>
<li>menu 2</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
:active = when a link it is being clicked.
:hover = when the mouse cursor is over the link
If you want the :active then this css should do it:
#main-menu a:active {
color: #0061bb;
}
If you wanna color the link you currently are, than you need JavaScript to add a class like class="currentLink" then add css to it
.currentLink {
color: #0061bb;
}
I am currently coding a website for a school project, and I have boxes that grow on a mouse hover that are in a div. An example of one grow div:
<div class="grow">
<div class="title3">Experience</div>
<div class="mainbox">
<p class="text">Sample text.</p>
</div>
</div>
In here, I need a <li> to list my industry certifications, but then it won't validate. So I was trying this:
<div class="grow">
<div class="title3">Experience</div>
<div class="mainbox">
<p class="text"><li>
<ul>Sample</ul>
<ul>Sample</ul></li></p>
</div>
</div>
But then this doesn't validate. What should I do instead, or is there another good alternative to a list that looks good?
You are including an UL inside of a LI, you need revert. First you need add UL and inside of this tag, add the LI you need.
<div class="grow">
<div class="title3">Experience</div>
<div class="mainbox">
<ul>
<li>Sample 1</li>
<li>Sample 2</li>
<li>Sample 3</li>
</ul>
</div>
</div>
UL wraps LIs.
<ul><li>....</li></ul>
I have this sample:
link
CODE HTML:
<header>
<div class="row">
<div class="col-md-push-8 col-md-4 menu-top">
<ul>
<li>text 1</li>
<li>text 2</li>
<li>text 3</li>
</ul>
</div>
<div class="col-md-4"> //this structure need to be below (not inline)
11231231
</div>
<div class="col-md-4">
11231231
</div>
<div class="col-md-4">
11231231
</div>
</div>
</header>
I put an image to understand better what I want to do
http://i64.tinypic.com/3342ofa.png
How to build HTML structure so as to be like in the picture above?
Thanks in advance!
Use thumbnail for image which is a class of Bootstrap.
Example :
<div class="col-md-4">
<a href="example.jpg" class="thumbnail">
<p>Stack Overflow</p>
<img src="stack.jpg" alt="Stack Overflow" style="width:150px;height:150px">
</a>
</div>
How can I completely change the layout of the submenu in WP?
Normally WP generates menu as UL > LI > UL > LI. but I need to change it to: UL > LI > DIV > ... > DIV > UL > ...
So there must be additional elements/wrappers to submenu. These wrappers also must contain custom CSS classes.
Is there a way to do this by some hooks or with some plugin?
The output should look like this
<ul>
<li>
<div class="sub">
<div class="wrapper">
<div class="section">
<div class="title"></div>
<ul>
<li></li>
...
<li></li>
</ul>
</div>
<div class="section">
<div class="title"></div>
<ul>
<li></li>
...
<li></li>
</ul>
</div>
...
</div>
</div>
</li>
<li>
<div class="sub">
<div class="wrapper">
<div class="section">
<div class="title"></div>
<ul>
<li></li>
...
<li></li>
</ul>
</div>
<div class="section">
<div class="title"></div>
<ul>
<li></li>
...
<li></li>
</ul>
</div>
...
</div>
</div>
</li>
...
</ul>
Thanks
Edit the template where your menu is displayed (probably header.php), and locate the wp_nav_menu function. Add or update the arguments items_wrap, before and after like this:
wp_nav_menu(array(
'menu' => 'your menu',
// [...] existing menu options
'items_wrap' => '<div><ul id="%1$s" class="%2$s">%3$s</ul></div>', // will put a div on ul
'before' => '<div>', // before the link
'after' => '</div>' // after the link
));
See https://codex.wordpress.org/Function_Reference/wp_nav_menu#Parameters
I am using tab through jquery now I want to add nested tab in tabs. MY problem is when I click on nested tab it will hide main tab and no content will show onclick on nested tab
Here is my code:-
<div id="tabs-container" class="TabView" >
<ul class="tabs-menu">
<li class="current">Guest</li>
<li>Owner</li>
</ul>
<div class="tab">
<div id="tab-1" class="tab-content">
<p>test></p>
<div id="subtab">
<ul class="tabs-menu">
<li>Me as Guest</li>
</ul>
<div id="subtab-1">test2</div>
</div>
</div>
Kindly advise me any solution.
Without seeing the jQuery part of the code nor the CSS we can only guess, anyway probably the problem is that you have to assign a different classname to the ul block in the nested tab. Like this:
<div id="tabs-container" class="TabView" >
<ul class="tabs-menu">
<li class="current">Guest</li>
<li>Owner</li>
</ul>
<div class="tab">
<div id="tab-1" class="tab-content">
<p>test></p>
<div id="subtab">
<ul class="subtabs-menu">
<li>Me as Guest</li>
</ul>
<div id="subtab-1">test2</div>
</div>
</div>