Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5943361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:23:03+00:00 2026-05-22T16:23:03+00:00

The jQuery .addclass function is working well to add classes, but they do not

  • 0

The jQuery .addclass function is working well to add classes, but they do not come in on a duration:

    jQuery(document).ready(function(){

newdiv = $('<div id=\'id".$row_new['ID']."\' style=\"display:none;\" class=\"eventdiv\" data-sort=\"" . $row_new['TimeStamp'] . "\">" . $row_new['Title'] . " TIME: " . $row_new['TimeStamp'] . "</div>');

    $('[data-sort=".$after."]').after(newdiv);

    $('#id".$row_new['ID']."').slideDown('slow', function() {                                                                                   
        $(this).addClass('gradient shadow curved_sml', 5000);
    });

    });

The code is escaped because it is returned as an object from a php page (through an ajax request) to an html page.

I have tried all different versions of JqueryUI and Jquery, none of them seem to allow it to add a duration to .addclass, the 5000 just becomes a delay.

Currently I have JqueryUI 1.8.9 and Jquery 1.5.2 installed because those versions seem to perform the duration in JSfiddle, but not on my page..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:23:04+00:00Added an answer on May 22, 2026 at 4:23 pm

    EDIT: I take some of this back… jQuery UI does accept a duration as the second parameter of addClass. jQuery itself does not accept a duration as the second parameter.
    The second parameter in jQuery UI is how long the effects of adding the class should last for; if you want to delay the addition of the class, then my answer still works.


    addClass does not accept a delay as the second parameter.

    If you want the class to be added 5 seconds after the slideDown has completed, use setTimeout:

     $('#id".$row_new['ID']."').slideDown('slow', function() {
        var that = this;                                                                                   
        setTimeout(function () {
            $(that).addClass('gradient shadow curved_sml');
        }, 5000);
     });
    

    If you want the slideDown to take 5 seconds, and the class’s to be added immediately:

    $('#id".$row_new['ID']."').slideDown(5000, function() {
        $(this).addClass('gradient shadow curved_sml');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jquery that I wrote: $(document).ready(function(){ $('div.contentTxtBox#home').addClass('current').show(); $('a.menu').click(function() { $('div.contentTxtBox.current').hide(slide, {
I have a working version of tooltip (jQuery Tools - http://flowplayer.org/tools/demos/tooltip/index.html ) , jQuery(document).ready(function()
Jquery has a great language construct that looks like this: $(document).ready(function() { $(a).click(function() {
I am working with jQuery and when I call the removeClass() function is not
I got a useful jQuery code, unfortunately its working great in Firefox but not
Thanks to inti's code I was able to figure out the answer! jQuery: $(document).ready(function(){
The jQuery $.post() function is not working in IE. I tried to open developer
I have the following jQuery: $(#toolbar).hover(function () { $(.logo).fadeOut(slow, function () { $(this).addClass(logohover) $(this).parent().addClass(logohover).fadeIn(slow,
I am using the following jquery code: $(#top ul li.corner).mouseover(function(){ $(span.left-corner).addClass(left-corner-hover); $(span.right-corner).addClass(right-corner-hover); $(span.content).addClass(content-hover); }).mouseout(function(){
Doing odd/even styling with jQuery is pretty easy: $(function() { $(.oddeven tbody tr:odd).addClass(odd); $(.oddeven

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.