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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:46:21+00:00 2026-06-15T09:46:21+00:00

This question is probably more a matter of syntax than anything else. I have

  • 0

This question is probably more a matter of syntax than anything else. I have some simple code that controls some custom tabs that flow on and off screen when clicked. For the most part the code (especially animation) works as intended and is not problematic.

<script type="text/javascript">
                    $('.side_drawer_face').click(function() {

                            if ($('#side_drawer').css("left") <= "0"){
                                  $('#overlay_div').show();  
                                  document.getElementById('side_drawer').style.zIndex = 6000;
                                  document.getElementById('side_drawer2').style.zIndex = 5000;
                                  $('#side_drawer').animate({ opacity: 1.0, left: '+=406'}, 500);
                                  $('#side_drawer2').animate({ opacity: 1.0, left: '+=406'}, 500);

                            } else if ($('#side_drawer').css("z-index") == "6000"){
                                  $('#overlay_div').hide();
                                  $('#side_drawer').animate({ opacity: 1.0, left: '-=406'}, 500);
                                  $('#side_drawer2').animate({ opacity: 1.0, left: '-=406'}, 500);
                                  document.getElementById('side_drawer').style.zIndex = 6000;
                                  document.getElementById('side_drawer2').style.zIndex = 5000;
                            }   else {
                                      document.getElementById('side_drawer').style.zIndex = 6000;
                                      document.getElementById('side_drawer2').style.zIndex = 5000;

                                }

                        });
                    $('.side_drawer_face2').click(function() {
                                //shows Bio div
                            if ($('#side_drawer2').css("left") <= "0"){
                                  $('#overlay_div').show(); 
                                  document.getElementById('side_drawer2').style.zIndex = 6000;
                                  document.getElementById('side_drawer').style.zIndex = 5000;
                                  $('#side_drawer').animate({ opacity: 1.0, left: '+=406'}, 500);
                                  $('#side_drawer2').animate({ opacity: 1.0, left: '+=406'}, 500);
                            } else if ($('#side_drawer2').css("z-index") == "6000"){
                                  $('#overlay_div').hide();
                                  $('#side_drawer').animate({ opacity: 1.0, left: '-=406'}, 500);
                                  $('#side_drawer2').animate({ opacity: 1.0, left: '-=406'}, 500);

                            } else {
                                  document.getElementById('side_drawer2').style.zIndex = 6000;
                                  document.getElementById('side_drawer').style.zIndex = 5000;

                            }
                        });
                    $('.clear_overlay').click(function() {

                                  $('#overlay_div').hide();
                                  $('#side_drawer').animate({ opacity: 1.0, left: '-=406'}, 500);
                                  $('#side_drawer2').animate({ opacity: 1.0, left: '-=406'}, 500);
                                  document.getElementById('side_drawer2').style.zIndex = 5000;
                                  document.getElementById('side_drawer').style.zIndex = 6000;
                        }); 

                    </script>

My problem is, in some browsers (that begin with I and end in E) rapidly clicking on the tab while other page elements are loading cause unexpected behavior. What I’d like to do is wrap the entire script with a document ready statement so that none of the functions can be executed until everything on the page is loaded. (the script is already located at the bottom of the html body)

  • 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-15T09:46:22+00:00Added an answer on June 15, 2026 at 9:46 am
    $(document).ready(function() {
                         $('.side_drawer_face').click(function() {
    
                                if ($('#side_drawer').css("left") <= "0"){
                                      $('#overlay_div').show();  
                                      document.getElementById('side_drawer').style.zIndex = 6000;
                                      document.getElementById('side_drawer2').style.zIndex = 5000;
                                      $('#side_drawer').animate({ opacity: 1.0, left: '+=406'}, 500);
                                      $('#side_drawer2').animate({ opacity: 1.0, left: '+=406'}, 500);
    
                                } else if ($('#side_drawer').css("z-index") == "6000"){
                                      $('#overlay_div').hide();
                                      $('#side_drawer').animate({ opacity: 1.0, left: '-=406'}, 500);
                                      $('#side_drawer2').animate({ opacity: 1.0, left: '-=406'}, 500);
                                      document.getElementById('side_drawer').style.zIndex = 6000;
                                      document.getElementById('side_drawer2').style.zIndex = 5000;
                                }   else {
                                          document.getElementById('side_drawer').style.zIndex = 6000;
                                          document.getElementById('side_drawer2').style.zIndex = 5000;
    
                                    }
    
                            });
                        $('.side_drawer_face2').click(function() {
                                    //shows Bio div
                                if ($('#side_drawer2').css("left") <= "0"){
                                      $('#overlay_div').show(); 
                                      document.getElementById('side_drawer2').style.zIndex = 6000;
                                      document.getElementById('side_drawer').style.zIndex = 5000;
                                      $('#side_drawer').animate({ opacity: 1.0, left: '+=406'}, 500);
                                      $('#side_drawer2').animate({ opacity: 1.0, left: '+=406'}, 500);
                                } else if ($('#side_drawer2').css("z-index") == "6000"){
                                      $('#overlay_div').hide();
                                      $('#side_drawer').animate({ opacity: 1.0, left: '-=406'}, 500);
                                      $('#side_drawer2').animate({ opacity: 1.0, left: '-=406'}, 500);
    
                                } else {
                                      document.getElementById('side_drawer2').style.zIndex = 6000;
                                      document.getElementById('side_drawer').style.zIndex = 5000;
    
                                }
                            });
                        $('.clear_overlay').click(function() {
    
                                      $('#overlay_div').hide();
                                      $('#side_drawer').animate({ opacity: 1.0, left: '-=406'}, 500);
                                      $('#side_drawer2').animate({ opacity: 1.0, left: '-=406'}, 500);
                                      document.getElementById('side_drawer2').style.zIndex = 5000;
                                      document.getElementById('side_drawer').style.zIndex = 6000;
                            }); 
    
    });
    

    Comments by Nick and Matt are correct — the syntax is super-easy, just bind the event handlers in the ready function

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably more a design or style question: I have just been considering
I have an unusual question. It's probably more about mobile than the html/php. The
Ok, so this question probably isn't Silverlight specific. I have a silverlight 2 page
I realize this question has probably been asked numerous times, but I have not
This is confusing me, so this question will probably be confusing. I have a
So, folks, I have this self crafted pattern that works. After some hours (I
This question probably is based on my lack of understanding of the role of
This question is probably borderline for stack overflow, so I apologize in advance if
this question has probably been asked before, but i'm stuck and i've tried a
I know this question is probably stoopid. But I just don't want to cause

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.