課題ですよ

by goropoo

HTML

<button id="bg1">BG1</button>
<button id="bg2">BG2</button>
<button id="back">元に戻れ</button>

<p id="hoge">fae</p>

<button>Clone Me!</button>

CSS

body {
background-color:#ffffff;
}


body.bg1 {
background-color:blue;
-webkit-transition:background-color 3s ease-in-out;
-moz-transition:background-color 3s ease-in-out;
-ms-transition:background-color 3s ease-in-out;
transition:background-color 3s ease-in-out;
}

body.bg2 {
 background-color:red;
-webkit-transition:background-color 3s ease-in-out;
-moz-transition:background-color 3s ease-in-out; 
-ms-transition:background-color 3s ease-in-out; 
}

JavaScript

$(function() {
    $('#bg1').click(function() {
        $('body').addClass('bg1').removeClass('bg2');
          });    
    $('#bg2').click(function() {
        $('body').addClass('bg2').removeClass('bg1');
          });     
    
    $('back').click(function() {
        $('body').removeClass('bg2').removeClass('bg1');
          });
});


$(window).bind('scroll', function(){
  alert('あいうえお');
});

$("button").click(function(){
  $(this).clone(true).insertAfter(this);
});