jQuery removeClass duration not working?
Asked Answered
D

1

5

I have a paragraph set with the following style:

.design_info_box p.design_info_desc
{
    height:30px;
    text-overflow: ellipsis;
    overflow:hidden;
}

With this, you can see the first 2 lines of text with a button to "read more" which expands the paragraph to show the rest of the text.

Here is the code for the button:

$(".read-more div").click(function(){
    $(this).parent().parent().children("p").removeClass("design_info_desc", "slow");
    $(this).hide();
});

This does remove the class and the entire paragraph is revealed. However, it does not animate. According to the docs removeClass should have a duration for animation. I also tried substituting "slow" with a number like 10000.

Is there a reason why it is not animating?

Dahlia answered 6/10, 2010 at 16:18 Comment(2)
Nice "read more" idea -- I like it!Loria
This is an excellent question, by the way. I wasn't previously aware of the option to animate a removeClass.Fustic
F
9

The reason this isn't working (I believe) is that this is a feature of jQueryUI, not the core jQuery library. Include a reference to jQueryUI in your page, and this should begin to work.

Check out a live demo here: http://jsfiddle.net/YaSh6/

Fustic answered 6/10, 2010 at 16:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.