jquery - how to change the display css attribute of a button within a li on hover
Tags: javascript,jquery,css
Problem :
I have a <li>
that onhover, should change the css 'display' attribute of a button within that <li>
. The idea is that hovering over that <li>
should make a button appear.
Right now my HTML is:
<li class="select-bldg-listing">
<button class="select-bldg-btn">Review</button>
</li>
my CSS:
.select-bldg-btn {
display: none;
}
jQuery:
$('.select-bldg-listing').hover(function () {
$('.select-bldg-btn').css('display', 'inline-block');
},
function(){
$('.select-bldg-btn').css('display', 'none');
});
But nothing happens when I mouseover on the page. What am I doing wrong?
Solution :
You can do this without JavaScript:
.select-bldg-btn {
display: none;
}
.select-bldg-listing:hover .select-bldg-btn {
display: inline-block;
}
CSS Howto..
Maybe you mean the focus attribute: http://www.w3schools.com/cssref/sel_focus.asp...
write like this css: .sketch_img_thumb_box{ opacity: 0.1; } .sketch_img_thumb_box:hover{ opacity: 1; } html: <div class="sketch_img_thumb_box"> <div class="title"></div> <div class="artist"></div> <div class="rating_bar"></div> </div> because if you give opacity the parent then...
Try this: JSFIDDLE <div class="hover-img"> <img src="http://www.wholesaleforeveryone.com/content/images/blank/600/solid_color.gif" class="img1"/> <p class="text">place holder text goes here</p> </div> .hover-img { position: relative; width: 200px; height: 200px; } .hover-img > img { position:...
There are many ways to mix colors, depending on what color model you're using: additive mixing subtractive mixing alpha compositing The following code snippet demonstrates two mixing methods. The leftmost...
If the grid is that big in width, there is nothing, by default that you can do to print it all in the same page... But, that's not bad news,...
The problem is correctly with your links. You have <img> inside anchor, but you try to hide img and leaves its parent anchor visible. It is impossiple after that to...
Writing background will override previously defined properties. Write: input[type="submit"], input[type="button"], .butLink{ background:#000; } ...
Solved my own problem. This works like a charm! CSS #Content{ width:100%; min-height:100%; } jQuery $(document).ready(function () { var docHeight = $('#content').height(); var wantedHeight = docHeight - 376;/*Minus header and...
You can easily track the latest versions of IE (mostly IE 10 and IE 11) using 1. CSS media query hack: /* #ie10,11 will only be red in MSIE 10,...
Here's a demo first, you need to "ID the body" for every page, giving it a distinction what page you are at. //when at home page <body id="home"> //or services...
What about a custom styled wrapper? HTML: <div class="select-wrapper"> <select> <option value="" disabled selected>Select your option</option> <option>First option</option> <option>Second really really really long option</option> </select> </div> SCSS:...
Yes it is possible. A quick google search took me to this working example with code: CSS Slider...
assuming you want the same visual margin/padding: http://jsfiddle.net/2U4Uv/2/ .sidebar { background: none repeat scroll 0 0 #F4F4F4; float: left; min-height: 600px; width: 250px; } .sidebar ul { float: left; list-style:...
you can use jQuery Load function to include header or menu html page, for example, to include a common header html file, <div id="new-header"> <script> $("#new-header").load("header.html"); </script> </div> ...
if you want to keep the button on the position's background you want ,you should be use the media query for 4 break point. add this code on the css...
Do you mean like this? http://jsfiddle.net/3Zv2y/2/ Make these changes: .bill-header-info { width:23%; text-align:center; } ...
You will need to add transformStyle:"preserve-3d" and z:50 to your text div #text: TweenLite.set($('#text'), {transformStyle:"preserve-3d",z:50}); So your code would be this: $(document).ready(function(){ TweenLite.set($('#container'), {perspective:1800}); // add the below TweenLite.set($('#text'),...
Your demo is lil weird but anyways, if you want to deduct 10em from 100% then use calc() property like #top { width: 100%; /* You won't need this */...
For the height difference you can add: line-height: 13px; display: inline-block; For the text weight difference you can try: text-rendering: optimizeLegibility; But typically you can't make Moz and WebKit display...
That is not possible in HTML/CSS. Absolute positioning allows placement like that, but you should ensure other content not clashing with it - no text flowing around. Float mechanism gives...
Here's greate tutorial Creating a Mobile Touch Slide Panel with JQuery. Source code also available on github - jstouchslide.
I would suggest you wrap it all in a wrapper div which is centered and has position relative. Then you can position the controls absolute like this: <div class="wrapper" style="margin:...
.nav li { font-family: 'Roboto', sans-serif; width: 149.6666666px; border-bottom: none; height: 106px; line-height: 106px; font-size: 14px; display: inline-block; float:left; margin: 0 auto; } In the above styling, width property is...
input[type="radio"] is an example of an attribute selector. It's part of the CSS3 spec and is perfectly legal. The only browser that doesn't support them is IE6. If supporting IE6...
The default styling of the WP menu looks like this: <nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation"> <div class="nav-menu"> <ul> <li class="page_item page-item-2"> <a href="">Sample Page</a> </li> </ul> </div> </nav> You should...
The problem is your line-height rule for #menus ul li a which targets links in drop down too. So 45px line-height in a 26px height parent can't be rendered fine....
<label> not <lable> too The vertical-align property sets the vertical alignment of an element. inline-block Displays an element as an inline-level block container. The inside of this block is formatted...
Succeeded in fixing this by using the background property at the /* Alternate shading for lines */ li.L1,li.L3,li.L5,li.L7,li.L9 { } and also using the !important keyword to overwrite the defaults....
There are two ways to apply CSS to XM. Unfortunately, you are attempting a mixture of the two and that cannot work. Your CSS stylesheet is obviously designed to be...
If you use width in % for .container you should use width in % for the child elements. Otherwise, you always will have errors on the different screen size. The...