8

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();
    });
});

4 Answers 4

21
$('#container').css('overflow','hidden');

Did you try this?

Sign up to request clarification or add additional context in comments.

2 Comments

I tried that, but didnt know where to put that in the script? I only want it to happen when the #signincontainer is shown, but be removed when the #signincontainer is hidden.
For easier extensibility and manipulation.. I would put that overflow style into a css class and then in jQuery use .addClass() instead of .css(). So then you will call addClass() after you show container and then call .removeClass() when you hide it.
1

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/

1 Comment

A minus with no comment? Thank you.
0

It's Simple to use:

$("p").css("color", "red");

You can follow this link : DEMO

Comments

0

You can also add multiple attributes

$('select_smth').css({
   'color' : 'red',
   'height' : '10px'
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.