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

  • Home
  • SEARCH
  • 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 8537743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:58:23+00:00 2026-06-11T10:58:23+00:00

JS on ios is rather slow. For example in this piece of code, the

  • 0

JS on ios is rather slow. For example in this piece of code, the Js adds the class before being able to add the block style. This breaks an animation i have on the page.

comments.style.display="block";comments.className = "show";

I have a workaround that fixes the issue on ios but just feels wrong:

comments.style.display="block";setTimeout(function(){comments.className = "show";},1)

Is there any way to determine if the block style has been set and only then trigger the second part?

Thanks for your suggestions!

  • 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-06-11T10:58:24+00:00Added an answer on June 11, 2026 at 10:58 am

    Can’t you just use an if?

    <div id="foo" style="display: none;">foo</div>
    
    var div = document.getElementById( "foo"  );
    if ( div.style.display == "none" ) {
        div.style.display = "block";
    }
    

    If you want to listen to a class change (or a style change) “event”, you can try these links:

    • Event detect when css property changed using Jquery <= this solves the problem without jQuery
    • jQuery – Fire event if CSS class changed
    • Trigger event using Jquery on CSS change?
    • Is it possible to listen to a "style change" event?

    I think the first one will solve your problem. Here is the code:

    document.documentElement.addEventListener( "DOMAttrModified", function( evt ){
        if ( evt.attrName === "style" ) {
            if ( evt.newValue.indexOf( "block" ) != -1 ) {
                alert( "do something!" );
            }
        }
    }, false );
    
    document.getElementById( "foo" ).style.display = "block";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am rather confused about how this would be possible with the iOS Sandbox,
So this is a rather specific question about the openAl implementation on ios. There
The iOS app Display Recorder claims to be able to record the screen of
I'm a beginner iOS/ObjectiveC coder and am trying to understand some details rather than
I'm writing StoreKit-related code, and I'm getting some rather troubling error codes when I
This is for an iOS project. I am reworking a section of my dataController
I understood that iOS 4.2 is for iPad as well. The code below is
This question is about iOS device rotation and multiple controlled views in a UINavigationController.
I have an iOS application and I am doing in this way: in the
So I stumbled upon a rather inconvenient 'feature' of the iOS SDK last night,

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.