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 8847027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:07:21+00:00 2026-06-14T12:07:21+00:00

I have implemented this code: <script> var mod_PPfix = false; Modernizr.load({ test: Modernizr.csstransitions &&

  • 0

I have implemented this code:

<script>
       var mod_PPfix = false;

        Modernizr.load({
            test: Modernizr.csstransitions && Modernizr.input.required,
            nope: ['script1.js', 'script2.js'],
            complete: function () {

                mod_PPfix = true;
                console.log('ppfix');
            }
        });
</script>

few lines after, I’ve placed this other script

<script>               
   if (!mod_PPfix) {
       $(document).ready(function() { 

           console.log('this should be seen only if modernizr's tests are true');
       });
   }
</script>

Now I’m really a rookie with javascript, but I expected from the code above to show the second console.log() only if the modernizr tests result to be true. Still the second log is recorded even when the tests result negative.

As far as I can tell, in the console the second console.log() message appears before the first one saying ‘ppfix’ so I guess that it should be a sort of load timing issue, but I really don’t know why. What am I doing wrong?

If it can help I’m using Jquery as library.

Thank you!

  • 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-14T12:07:22+00:00Added an answer on June 14, 2026 at 12:07 pm

    If you want to see the the second log message when the tests are true, don’t you mean if (mod_PPfix)? Your version will log output the second message if the tests failed (see this fiddle)

    When you use Modernizr.load things happen asynchronously so the second <script> might run before script1.js and script2.js finish loading and therefore before the complete callback fires. Whatever you want to do in the second <script> you should call in the complete callback. For example

        Modernizr.load({
            test: Modernizr.csstransitions && Modernizr.input.required,
            nope: ['script1.js', 'script2.js'],
            complete: function () {
                initialize_me();
            }
        });
    

    Where the initialize_me() function would be defined elsewhere and might have have code that looks like

    if (Modernizr.csstransitions && Modernizr.input.required) {
        // Use CSS3
    } else {
        // Do things that depended on script1.js and script2.js being loaded
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented correctly bump's api, and added this code: - (void) configureBump {
I have this code implemented and I like how straight forward it is because
I have implemented the following code from this page: http://tympanus.net/codrops/2010/06/02/smooth-vertical-or-horizontal-page-scrolling-with-jquery/ $(document).ready(function() { $('ul.navone li
I have the following jQuery code: <script type=text/javascript> $(document).ready(function() { var color = ['none',
I have the following code sample to illustrate my point. When I load this
I have implemented exactly the code which is shown on this page: http://developers.facebook.com/docs/reference/dialogs/feed/ Problem:
I've implemented part of this script to help me with debugging var ZFDebugLoad =
I have been using this code to implement a Popup JDialog of sorts, like
I have this piece of code: @Entity @Table(name = MOVERS) public class MOVers implements
So, I have implemented this method to add a footer to my table view:

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.