We have tabs working correctly using this HTML
<div class="col-lg-3 col-md-3 panel-container">
<ul class="nav nav-pills nav-stacked">
<li class="active"><a data-toggle="pill" href="#general" ng-class="{true: 'invalid-tab', false: ''}[form.editTemplateGeneralForm.$invalid]">#Labels.general</a></li>
<li><a data-toggle="pill" href="#startingValues" ng-class="{true: 'invalid-tab', false: ''}[form.editTemplateStartingValuesForm.$invalid]">#Labels.startingValues</a></li>
</ul>
</div>
The invalid-tab used to work fine, and when the tab was invalid it was shown in red. Now it's no longer working and we suspect it's the newest version of AngularJS that broke that functionality. We're using v1.3.13.
Do you know what should be adjusted in that syntax above to make it work again (that is used in many pages of our application).
Here is the invalid-tab from our site.css:
.widget .invalid-tab * {
background-color: #F9EAF3;
/*color: #F9EAF3;*/
color: #d43f3a;
}
.widget .invalid-tab:hover * {
background-color: #E06B6C;
color: #ffffff;
}
The correct way to define ng-class is as follows: ng-class="{classname: expresstion}"
You also need to remove the asterisk from the css-selector - as you are selecting any child element. But the .invalid-tab has no child elements.
Another solution would be to move the .invalid-tab class out to the parent li-element
angular.module('myApp', [])
.directive('testApp', function(){
return {
link: function(scope) {
scope.form = {
editTemplateStartingValuesForm: {$invalid: true},
editTemplateGeneralForm: {$invalid: false}
};
}
};
});
.widget .invalid-tab {
background-color: #F9EAF3;
/*color: #F9EAF3;*/
color: #d43f3a;
}
.widget .invalid-tab:hover {
background-color: #E06B6C;
color: #ffffff;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js"></script>
<div ng-app="myApp" class="widget" test-app>
<div class="col-lg-3 col-md-3 panel-container">
<ul class="nav nav-pills nav-stacked">
<li class="active">
<a data-toggle="pill" href="#general" ng-class="{'invalid-tab': form.editTemplateGeneralForm.$invalid}">#Labels.general</a>
</li>
<li>
<a data-toggle="pill" href="#startingValues" ng-class="{'invalid-tab': form.editTemplateStartingValuesForm.$invalid}">#Labels.startingValues</a>
</li>
</ul>
</div>
</div>
Related
So I have multiple LI's like below as it's a menu and I am trying to create a drop-down but for some reason, my jQuery code is not working. Can someone help me?
FYI I can't change HTML as it's dynamically generating in Shopify. I can only change jQuery and CSS
<li class="grid__item lvl-1 ">
<a class="site-nav lvl-1 light-body">Furry Artist</a>
<ul class="subLinks inactive">
<li class="lvl-2">
Erdbeer Joghurt
</li>
<li class="lvl-2">
Jeson RC
</li>
</ul>
</li>
$( document ).ready(function() {
$("ul.subLinks").addClass("inactive");
});
$('a.site-nav.lvl-1').click(function() {
$(this).find("ul.subLinks").toggleClass('active-drop-down');
});
.inactive {
display:none;
}
.active-drop-down {
display:block !important;
}
Your issue is $(this).find... in the a click handler - at this point, this is the a.
.find() looks at the selectors children - but the menu is not a child of the a, it's a sibling.
Change to
$(this).closest("li").find("ul.subLinks"...
(maybe $(this).next().toggleClass... with a caveat on .this() that it's always the very next element).
Updated snippet:
$('a.site-nav.lvl-1').click(function() {
$(this).closest("li").find("ul.subLinks").toggleClass('active-drop-down');
});
.inactive {
display:none;
}
.active-drop-down {
display:block !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ol>
<li class="grid__item lvl-1 ">
<a class="site-nav lvl-1 light-body">Furry Artist</a>
<ul class="subLinks inactive">
<li class="lvl-2">
Erdbeer Joghurt
</li>
<li class="lvl-2">
Jeson RC
</li>
</ul>
</li>
</ol>
I'm trying to make a navigation menu with tabs and I use negative margin to group the elements and I want the active element to stay over the inactive elements. I used position: absolute but it had no effect. How can I do this?
.nav-item {
margin: -40px;
}
.nav-link {
color: #F2BF5E !important;
font-weight: 700 !important;
}
.nav-link.active {
color: white !important;
font-weight: 700 !important;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
<div style="margin-top: 10%" class="row">
<div class="col">
<ul style="display: flex; justify-content: center;" class="nav nav-pills nav-pills-warning" role="tablist">
<li (click)="teste('entrar')" class="nav-item" style="width: 200px;">
<a class="nav-link active" data-toggle="tab" href="#link1" role="tablist">
Entrar
</a>
</li>
<li (click)="teste('cadastrar')" class="nav-item" style="width: 200px;">
<a data-toggle="tab" class="nav-link" href="#link2" role="tablist">
Cadastrar
</a>
</li>
</ul>
</div>
</div>
Currently, this is what I have:
enter image description here
If I am understanding you correctly, you want an image to be on top of the other, and vice versa, based off of whether it is 'active' or not.
In this case, I would imagine using the z-index is what you would want. It is a CSS property that provides depth/stacking based off of an integer value.
.nav-link.active {
z-index:1;
position:absolute;
color: white !important;
font-weight: 700 !important;
}
You might have to modify your code a bit to get it to how you want exactly; I'm just trying to provide a concept. You can just toggle the z-index value based off of whether it is 'active'
I have a <li class="jobs-dashboard1"> I'd like to target with CSS. The problem is that it's not responding, so I wondered if it's possible to specify somehow with the id of the parent <ul> like so:
#adminmenu.jobs-dashboard1 {
background-color: green;
}
<div id="adminmenuback"></div>
<div id="adminmenuwrap">
<ul id="adminmenu">
<li class="wp-first-item wp-has-submenu wp-has-current-submenu wp-
menu-open menu-top menu-top-first menu-icon-dashboard menu-top.
first" id="menu-dashboard">
<a href='index.php' class="wp-first-item
wp-has-submenu wp-has-current-submenu wp-menu-open menu-top menu-
top-first menu-icon-dashboard menu-top-first">
<div class="wp-menu-
arrow">
<div></div>
</div>
<div class='wp-menu-image dashicons-before
dashicons-dashboard'><br /></div>
<div class='wp-menu-
name'>Dashboard</div>
</a>
<ul class='wp-submenu wp-submenu-wrap'>
<li class='wp-submenu-head' aria-hidden='true'>Dashboard</li>
<li class="wp-first-item current">.
Home</li>
<li><a href='update-core.php'>Updates
<span class='update-plugins count-37'><span class='update.
count'>37</span></span></a></li>
<li class="jobs-dashboard1"><a href='https://adsler.co.uk/jobs-dashboard/' class="jobs.
dashboard1">Jobs</a></li>
<li class="post-job1"><a href='https://adsler.co.uk/post-a-job/' class="post-job1">Post A
Job</a></li>
<li class="events-dashboard1"><a href='https://adsler.co.uk/your-events-dashboard/' class="events.
dashboard1">Events</a></li>
<li class="post-event1"><a href='https://adsler.co.uk/post-an-event/' class="post-event1">Post
An Event</a></li>
</ul>
</li>
This didn't work, and I don't know why.
If you see Jobs in the screenshot... that's one of them I'm trying to target.
The site is https://adsler.co.uk if that helps, but it's a backend modification.
Where are you adding this CSS? You cannot add it to typical CSS files that you use on your website, because those are all loaded on the Frontend, and not loaded in the Wordpress Dashboard.
You also shouldn't have to target your item with an ID before the class, if the item has its own class already, and is only used on that item. If you use this class on more than one item then you can specify an ID or other selector.
Add this to the end your functions.php or a custom plugin
Here is the original posted solution:
add_action('admin_head', 'custom_admin_css');
function custom_admin_css() {
echo '<style>
.jobs-dashboard1 {background: green;}
</style>';
}
Here is another way that should also work.
add_action( 'admin_head', 'custom_admin_css' );
function custom_admin_css() { ?>
<style>
.jobs-dashboard1 {background-color: green; }
</style>
<?php }
Well, you have missed a space in your CSS declaration.
it should be,
#adminmenu .jobs-dashboard1 {background-color: green;}
Hope this helps!
It is because you have more layers of nodes over the ".jobs-dashboard1". So you could use this:
#adminmenu #menu-dashboard .wp-submenu .jobs-dashboard1{background-color: green;}
or if you want a cleaner way:
#adminmenu li ul .jobs-dashboard1{background-color: green;}
It works, Please check the below snippet. Also check CSS Combinators
#adminmenu .jobs-dashboard1 {
background-color: green;
}
<div id="adminmenuback"></div>
<div id="adminmenuwrap">
<ul id="adminmenu">
<li class="wp-first-item wp-has-submenu wp-has-current-submenu wp-
menu-open menu-top menu-top-first menu-icon-dashboard menu-top.
first" id="menu-dashboard">
<a href='index.php' class="wp-first-item
wp-has-submenu wp-has-current-submenu wp-menu-open menu-top menu-
top-first menu-icon-dashboard menu-top-first">
<div class="wp-menu-
arrow">
<div></div>
</div>
<div class='wp-menu-image dashicons-before
dashicons-dashboard'><br /></div>
<div class='wp-menu-
name'>Dashboard</div>
</a>
<ul class='wp-submenu wp-submenu-wrap'>
<li class='wp-submenu-head' aria-hidden='true'>Dashboard</li>
<li class="wp-first-item current">.
Home</li>
<li><a href='update-core.php'>Updates
<span class='update-plugins count-37'><span class='update.
count'>37</span></span></a></li>
<li class="jobs-dashboard1"><a href='https://adsler.co.uk/jobs-dashboard/' class="jobs.
dashboard1">Jobs</a></li>
<li class="post-job1"><a href='https://adsler.co.uk/post-a-job/' class="post-job1">Post A
Job</a></li>
<li class="events-dashboard1"><a href='https://adsler.co.uk/your-events-dashboard/' class="events.
dashboard1">Events</a></li>
<li class="post-event1"><a href='https://adsler.co.uk/post-an-event/' class="post-event1">Post
An Event</a></li>
</ul>
</li>
I have this older site (Bootstrap 3.3.6) I put together for a client and have noticed that a button in the navbar is noted as active and I can't seem to clear it.
It visually looks like this :
Screenshot of issue with buttons
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav navbar-right">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden">
<a class="page-scroll" href="#page-top"></a>
</li>
<li>
<a class="page-scroll" href="#registration">REGISTRATION & PROGRAMS</a>
</li>
<li>
<a class="page-scroll" href="#coaches">OUR COACHES</a>
</li>
<li>
<a class="page-scroll" href="#contact">CONTACT</a>
</li>
<li>
<img src="img/FB-f-Logo50px.png" alt="Find us on Facebook!">
</li>
</ul>
</div>
When I view it under active circumstances the button for CONTACT displays as such :
<li class="active">
<a class="page-scroll" href="#contact">CONTACT</a>
</li>
CSS :
a {
font-family: "HypatiaSansPro-Regular";
color:#CC3333;}
.btn {
background-color: #CC3333;
outline-color: #CC3333;}
.btn:hover,
.btn:focus,
.btn.active {
background-color: #993333;
outline-color: #CC3333;}
.contact-section {
padding-top: 100px;
padding-top: 100px;
padding-bottom: 50px;
text-align: center;
background: #eee;}
If I change the order of the buttons I will get the same issue for any of the buttons that are last.
This is a one page bootstrap site, the page has 3 anchors. I can send private messages of the site in question if it helps.
It's a minor issue, but it is really bothering me that there is a conflict and I cannot clear it. Any feedback?
Bootstrap adds a class that highlights the active element:
.navbar-nav>.active>a{
color: #555;
background-color: #e7e7e7;
}
You can overwrite that selector by placing the same selector with the values you want in a css stylesheet loaded after bootstrap's css.
.navbar-nav>.active>a{
color: #777;
background-color: transparent;
}
Alternatively you can to remove the .active class somehow. But I think bootstrap adds that automatically. So that would probably be a hassle to do.
<div id="header" class="top-bar">
...
</div>
<div id="specificdiv" class="top-bar">
<ul>
<li>
<li class="dropdown active">
<li class="dropdown active">
<li class="dropdown active">
<li>
</ul>
</div>
<div id="footer" class="top-bar">
...
</div>
I need to exclude style for specific <li> tags under div id="specificdiv".
I could exclude first element using this
.top-bar li:not(:first-of-type) {
float: none;
}
but how to remove rest 2 as well?
Use the direct descendant selector >. It only selects the immediate descendants of the targeted parents.
You could use #specificdiv ul > li and it will only select li on the first level of children.
And as BoltClock pointed out, you should wrap the li whose parent is a li inside of a ul.
<div id="specificdiv" class="top-bar">
<ul>
<li>
<ul>
<li class="dropdown active">
<li class="dropdown active">
<li class="dropdown active">
</ul>
<li>
</ul>
</div>
Why don't you just add class for the <li>, that you want to style?
Example:
<ul>
<li class="someClass">
<li class="dropdown active">
<li class="dropdown active">
<li class="dropdown active">
<li>
</ul>
And then your style:
.someClass{
float:none;
}
#specificdiv li:not(:first-of-type)
{
float: none;
}
it will work.
# is used to select element by id. example #my will select element which has id=my
for that you need nth-child(an+b) you can use it like this
li:nth-child(2){
..
}
li:nth-child(3){
..
}
now you hve a lot of alternative
ul li:nth-child(3n+3) {
color: #ccc;
}
li:nth-child(4n-7) { /* or 4n+1 */
color: green;
}
and if you want to check special lis use the > like this
div#pecificdiv ul.myList >li:nth-child(odd) {
color: green;
}
check this link for useful nth-child recipes
http://css-tricks.com/useful-nth-child-recipies/
and this
http://css-tricks.com/how-nth-child-works/