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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:24:24+00:00 2026-05-22T12:24:24+00:00

Any JavaScript pros out there? I’ve got a div that I’ve managed to fade

  • 0

Any JavaScript pros out there? I’ve got a div that I’ve managed to fade in after entering the konami code, and a button that you can click to fade out the div, but I have to refresh in order to re-enter the konami code. I want to be able to continually enter in the konami code without having to refresh the page. Ideally, I’d like to remove the button, but I can’t seem to get things to work just using if statements.

Here’s what I have so far:

<script
  src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" 
  type="text/javascript"></script>

<script type= "text/javascript">
var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65,13";
$(document).keydown(function(e) {
  kkeys.push( e.keyCode );
  if ( kkeys.toString().indexOf( konami ) >= 0 )
  {
    $(document).unbind('keydown',arguments.callee);
    $(document).ready(function()
    {
      $(".konami").fadeIn(1000);
    });
  }
});

</script>
<script type="text/javascript">

$(document).ready(function(){

  $(".btn1").click(function(){

  $(".konami2").fadeOut(1000);

  });
});
</script>

<div class ="konami" style="display: none">
<p class ="konami2">

Hello! Type "bye" to remove!

</p>
<button class="btn1">Fade out</button>
</div>
  • 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-22T12:24:25+00:00Added an answer on May 22, 2026 at 12:24 pm

    If you empty your keypress history array when the user has typed in the key, that should allow the process to repeat. So, instead of

    $(document).unbind('keydown',arguments.callee);
    

    you could simply do this

    kkeys = [];
    

    Of course, you should decide what happens when the user types in the code the second time. Here’s a version that toggles the visibility of your div. Note that I upgraded your jquery version to support the fadeToggle function.

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
    <script>
    var kkeys = [];
    var konami = "38,38,40,40,37,39,37,39,66,65,13";
    $(document).keydown(function(e) {
        kkeys.push(e.keyCode);
        if (kkeys.toString().indexOf(konami) >= 0)
        {
            kkeys = [];
            $(".konami").fadeToggle(1000);
        }
    });
    </script>
    
    <div class="konami" style="display: none">
        <p class="konami2">
            Hello! Type the code again to remove!
        </p>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wondering if there is a tool out there that does any javascript code
Are there any JavaScript libraries out there that allow you to create heatmaps using
Are there any good JavaScript frameworks out there which primary audience is not web
Is there any javascript plugin/library/script that will can transform a standard PHP to use
Is there any JavaScript method similar to the jQuery delay() or wait() (to delay
These ribbon in stackoverflow and uservoice.com looks nice. is there any javascript library/jquery plugin
Is there any way in JavaScript to create a "weak reference" to another object?
Is there any free hosting for Javascript? Recently google has been hosting jQuery,etc... and
Are there any commonly used patterns in Javascript for storing the URL's of endpoints
There are a lot of JavaScript libraries out there these days (extJs, Scriptaculous, Dojo,

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.