码迷,mamicode.com
首页 > Web开发 > 详细

jQuery - Events

时间:2016-07-30 18:01:56      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:

 

$(document).ready(function() {
    $(‘thingToTouch‘).event(function() {
        $(‘thingToAffect‘).effect();
    });
});

 

$(document).ready(function() {
    $(document).keydown(function(key) {
        switch(parseInt(key.which,10)) {
            // Left arrow key pressed
            case 37:
                $(‘img‘).animate({left: "-=10px"}, ‘fast‘);
                break;
            // Up Arrow Pressed
            case 38:
                // Put our code here
                $(‘img‘).animate({top: "-=10px"}, ‘fast‘);
                break;
            // Right Arrow Pressed
            case 39:
                // Put our code here
                $(‘img‘).animate({left: "+=10px"}, ‘fast‘);
                break;
            // Down Arrow Pressed
            case 40:
                // Put our code here
                $(‘img‘).animate({top: "+=10px"}, ‘fast‘);
                break;
        }
    });
});

 

jQuery - Events

标签:

原文地址:http://www.cnblogs.com/elewei/p/5721359.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!