cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Captain Planet: The Game</title>
  <!-- Bootstrap File -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
  <!-- JQuery -->
  <script src="https://code.jquery.com/jquery.js"></script>
</head>

<body>
  <!-- Overall Bootstrap Grid -->
  <div class="container">
    <!-- Jumbotron with Title -->
    <div class="jumbotron">
      <h1 class="text-center"><strong>Captain Planet: The Game!</strong></h1>
      <h4 class="text-center">Rated M for Mature</h4>
      <hr>
<!--       <div class="text-center">
        <button class="btn btn-warning btn-xs themeButton"><span class="glyphicon glyphicon-music"></span> Play Theme!</button>
        <button class="btn btn-default btn-xs pauseButton"><span class="glyphicon glyphicon-pause"></span> Pause Song</button>
      </div> -->
    </div>
    <div class="row">
      <!-- Left Panel -->
      <div class="col-lg-6">
        <!-- Controls (Superpower Grow/Shrink)-->
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">Superpowers - Change Sizes!</h3>
          </div>
          <div class="panel-body">
            <div class="text-center">
              <button class="btn btn-default btn-lg normalButton"><span class="glyphicon glyphicon-ok-sign"></span> Normal</button>
              <button class="btn btn-primary btn-lg growButton"><span class="glyphicon glyphicon-plus-sign"></span> Grow</button>
              <button class="btn btn-warning btn-lg shrinkButton"><span class="glyphicon glyphicon-minus-sign"></span> Shrink</button>
              <button class="btn btn-danger btn-lg destroyButton"><span class="glyphicon glyphicon-fire"></span> Destroy World!</button>
            </div>
          </div>
        </div>
        <!-- Controls (Superpower Visibility) -->
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">Superpowers - Invisiblity!</h3>
          </div>
          <div class="panel-body">
            <div class="text-center">
              <button class="btn btn-default btn-lg visButton"><span class="glyphicon glyphicon-eye-open"></span> Visible</button>
              <button class="btn btn-info btn-lg invisButton"><span class="glyphicon glyphicon-eye-close"></span> Invisible</button>
            </div>
          </div>
        </div>
        <!-- Controls (Superpower Move Controls) -->
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">Move Controls</h3>
          </div>
          <div class="panel-body">
            <div class="text-center">
              <button class="btn btn-default btn-lg upButton"><span class="glyphicon glyphicon-arrow-up"></span></button>
            </div>
            <div class="text-center">
              <button class="btn btn-default btn-lg leftButton"><span class="glyphicon glyphicon-arrow-left"></span></button>
              <button class="btn btn-default btn-lg downButton"><span class="glyphicon glyphicon-arrow-down"></span></button>
              <button class="btn btn-default btn-lg rightButton"><span class="glyphicon glyphicon-arrow-right"></span></button>
            </div>
            <br>
            <div class="text-center">
              <button class="btn btn-default btn-lg backButton"><span class="glyphicon glyphicon-comment"></span> Go Planet!</button>
            </div>
          </div>
        </div>
      </div>
      <!-- Right Panel (Captain Planet Hero)-->
      <div class="col-lg-6">
        <!-- Captain Planet Image -->
        <img src="http://screencrush.com/442/files/2013/06/captain-planet-01.jpg" alt="" class="img captainplanet destroy" style="position:absolute; top:50px; left: 80px; z-index: 1; height: 300px">
      </div>
    </div>
  </div>
  
</body>

</html>
            
          
!
            
              
    // Javascript function that wraps everything
    $(document).ready(function() {

                // Gets Link for Theme Song
                var audioElement = document.createElement('audio');
                audioElement.setAttribute('src', 'https://res.cloudinary.com/thefinleycode/image/fetch/https://res.cloudinary.com/thefinleycode/video/upload/v1471282750/captainplanet24_h3z2bb.mp3');

                // Theme Button
                $(".themeButton").on("click", function() {
                    audioElement.play();
                });

                $(".pauseButton").on("click", function() {
                    audioElement.pause();
                });

                // Size Buttons
                $(".normalButton").on("click", function() {
                    $(".captainplanet").animate({
                        height: '300px'
                    });
                });

                $(".growButton").on("click", function() {
                    $(".captainplanet").animate({
                        height: '500px'
                    });
                });

                $(".shrinkButton").on("click", function() {
                    $(".captainplanet").animate({
                        height: '100px'
                    });
                });

                $(".destroyButton").on("click", function() {
                        $('.destroy').css({
                                position: 'absolute', left: -700, top:-400});

                                // left: ($(window).width() - $('.drop2').outerWidth()) / 2,
                                // top: ($(window).height() - $('.drop2').outerHeight()) / 2, });
                             $(".captainplanet").animate({
                                height: '1000px'
                            }); $('body').css('background-color', 'red');
                          
                        });

                    // Visibility Buttons
                    $(".visButton").on("click", function() {
                        $(".captainplanet").animate({
                            opacity: '1'
                        });
                    });

                    $(".invisButton").on("click", function() {
                        $(".captainplanet").animate({
                            opacity: '0.05'
                        });
                    });

                    // Move Buttons
                    $(".upButton").on("click", function() {
                        $(".captainplanet").animate({
                            top: "-=200px"
                        }, "normal");
                    });

                    $(".downButton").on("click", function() {
                        $(".captainplanet").animate({
                            top: "+=200px"
                        }, "normal");
                    });

                    $(".leftButton").on("click", function() {
                        $(".captainplanet").animate({
                            left: "-=200px"
                        }, "normal");
                    });

                    $(".rightButton").on("click", function() {
                        $(".captainplanet").animate({
                            left: "+=200px"
                        }, "normal");
                    });

                    $(".backButton").on("click", function() {
                        $(".captainplanet").animate({
                            top: "50px",
                            left: "80px"
                        }, "fast");
                    });

                    // Move Buttons (Keyboard Down)
                    $(document).keyup(function(e) {
                        switch (e.which) {
                            case 40:
                                $(".captainplanet").animate({
                                    top: "+=200px"
                                }, "normal");
                        }
                    });

                    // Move Buttons (Keyboard Right)
                    $(document).keyup(function(e) {
                        switch (e.which) {
                            case 39:
                                $(".captainplanet").animate({
                                    left: "+=200px"
                                }, "normal");
                        }
                    });

                    // Move Buttons (Keyboard Up)
                    $(document).keyup(function(e) {
                        switch (e.which) {
                            case 38:
                                $(".captainplanet").animate({
                                    top: "-=200px"
                                }, "normal");
                        }
                    });

                    // Move Buttons (Keyboard Left)
                    $(document).keyup(function(e) {
                        switch (e.which) {
                            case 37:
                                $(".captainplanet").animate({
                                    left: "-=200px"
                                }, "normal");
                        }
                    });

                });
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console