2015年2月18日水曜日

開発環境

  • OS X Yosemite - Apple (OS)
  • Safari, Firefox, Google Chrome(Webプラウザ)
  • Emacs (CUI)、BBEdit - Bare Bones Software, Inc.(GUI) (Text Editor)
  • JavaScript (プログラミング言語)

Head First jQuery(Ryan Benedetti(著)、Ronan Cranley(著)、O'Reilly Media)のChapter 5(jQuery Effects and Animation: A Little Glide in Your Stride)、EXERCISE(No. 2772)を解いてみる。

その他参考書籍

EXERCISE(No. 2772)

JavaScript(BBEdit, Emacs)

$(document).ready(function () {
    var headclix = 0,
        eyesclix = 0,
        noseclix = 0,
        mouthclix = 0;
    
    $('#head').click(function () {
        
        if (headclix < 9) {
            headclix += 1;
        } else {
            headclix = 0;
        }
    });
    $('#eyes').click(function () {
        
        if (eyesclix < 9) {
            eyesclix += 1;
        } else {
            eyesclix = 0;
        }
    });
    $('#nose').click(function () {
        
        if (noseclix < 9) {
            noseclix += 1;
        } else {
            noseclix = 0;
        }
    });
    $('#mouth').click(function () {
        
        if (mouthclix < 9) {
            mouthclix += 1;
        } else {
            mouthclix = 0;
        }
    });
    $('#lightning1').fadeIn(250).fadeOut(250);    
});

index2772.html

0 コメント:

コメントを投稿