開発環境
- 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 7(Custom Functions for Custom Effects: What Have You Done for Me Lately?)、JQUERY MAGNETS(No. 3819)を解いてみる。
その他参考書籍
JQUERY MAGNETS(No. 3819)
JavaScript(BBEdit, Emacs)
$(document).ready(function(){
var clix = [0, 0, 0, 0],
int1,
int2,
int3,
moveMe = function (i, obj) {
if (clix[i] < 9) {
$(obj).animate({left: '-=367px'}, 500);
clix[i] += 1;
} else {
clix[i] = 0;
$(obj).animate({left:'0px'}, 500);
}
},
goLighting = function () {
int1 = setInterval( function () {
lightning_one();
}, 4000);
int2 = setInterval( function () {
lightning_two();
}, 5000);
int3 = setInterval( function () {
lightning_three();
}, 7000);
},
stopLightning = function () {
window.clearInterval(int1);
window.clearInterval(int2);
window.clearInterval(int3);
},
lightning_one = function () {
$('#container #lightning1').fadeIn(250).fadeOut(250);
},
lightning_two = function () {
$('#container #lightning2').fadeIn(250).fadeOut(250);
},
lightning_three = function () {
$('#container #lightning3').fadeIn(250).fadeOut(250);
};
goLighting();
window.onblur = stopLightning;
window.onfocus = goLighting;
$("#head").click(function(){
moveMe(0, this);
});
$("#eyes").click(function(){
moveMe(1, this);
});
$("#nose").click(function(){
moveMe(2, this);
});
$("#mouth").click(function(){
moveMe(3, this);
});
});
0 コメント:
コメントを投稿