zoukankan      html  css  js  c++  java
  • jQuery 基础教程(第3版) ---第四章习题答案

        //第一题
        $('#container').fadeIn('slow');
        
        //第二题
        var color;
        $('p').hover(function(){
            color = $(this).css('backgroundColor');
            $(this).css('backgroundColor','yellow');
        },function(){
            $(this).css('backgroundColor',color);
        });
        
        //第三题
         $('div#container h2').click(function(){
            $(this).fadeTo('slow',0.25);
            $(this).css({'margin-left':'20px'});
        });  
        //或者
            $('div#container h2').click(function(){
            $(this).animate({
                opacity:0.25,
                'margin-left':'20px'
            },'slow');
        });
        
        
        //第四题
        $(document).keyup(function(event){
            $('#switcher').css('position','relative');
            switch(event.keyCode){
                case 37:
                    $('#switcher').animate({'left':'-=20px'},'slow');
                    break;
                case 38:
                    $('#switcher').animate({'top':'-=20px'},'slow');
                    break;
                case 39:
                    $('#switcher').animate({'left':'+=20px'},'slow');
                    break;
                case 40:
                    $('#switcher').animate({'top':'+=20px'},'slow');
                    break;
            }
        });
  • 相关阅读:
    小数的进制转换
    水题 O
    水题 J
    水题T,二进制转16进制
    水题B
    水题C
    HDU 2042
    HDU 2041
    Index For SQL Server
    Learning Note For Angular
  • 原文地址:https://www.cnblogs.com/wanlxz/p/3450735.html
Copyright © 2011-2022 走看看