I need to set a CSS property in this script to go along with the animation, but I can't seem to do it right.
I need the div
with ID of "container" to have a CSS property set when the click function is activated. I need an overflow: hidden
set to #container
.
Here's my script.
$(function() {
$(".folderContent").hide();
$(".signin").click(function(event) {
var folderContent = $(".folderContent");
var folderContentShown = folderContent.css("display") != "none";
var clickedFolder = $(this);
clickedFolder.parent("#signincontainer").after(folderContent);
$("body").find("#container").not(clickedFolder).each(function() {
if (!folderContentShown) $(this).not("#signincontainer").animate( {
opacity: 0.50
}, "slow");
else $(this).animate({
opacity: 1.00
}, "slow");
});
//clickedFolder.animate({opacity: folderContentShown ? 1.00 : 0.70}, "fast");
folderContent.slideToggle();
event.preventDefault();
});
});
It is possible to change the CSS property of an element by using a simple JavaScript API, but we try to complete this challenge using jQuery css() method. Syntax: $().
jQuery css() Method The css() method sets or returns one or more style properties for the selected elements. When used to return properties: This method returns the specified CSS property value of the FIRST matched element.
You can get the computed value of an element's CSS property by simply passing the property name as a parameter to the css() method. Here's the basic syntax: $(selector). css("propertyName");
Apply multiple CSS properties using a single JQuery method CSS( {key1:val1, key2:val2....). You can apply as many properties as you like in a single call. Here you can pass key as property and val as its value as described above.
$('#container').css('overflow','hidden');
Did you try this?
You should just go to the jquery site and read it... it will make more sense and it is really straight forward.
http://api.jquery.com/css/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With