zoukankan      html  css  js  c++  java
  • jQuery事件

    $(function(){

      $('*').each(function(){

        var current = this;

        this.addEventListener('click',function(event){

          say('Capture for ' + current.tagName + '#' + current.id + 'target is' + event.target.id)  

        },true);

        

        this.addEventListener('click',function(event){

          say('Bubble for ' + current.tagName + '#' + current.id + 'target is' + event.target.id)  

        },false)

        function say(text){

          $('#console').append('<div>'+text+'</div>');

        }

      })

    })

    <body id='greatgrandpa'>

      <div id='grandpa'>

        <div id='pops'>

        <img id='vstar' src='vster.jpg'/>

        </div>

      </div>

      <div id='console'></div>

    </body>

    其实这个图已经可以看出一些东西了 事件在不同处理阶段通过DOM树的传播情况

    =========================================================

    关于事件

    JQ 我自己推荐

    input改变 用change()

    其他的可以on  当然on绑定前 需要off解绑

    -----------------------------------------------------------------------------------------

    写一个有点用的动画 页面上从上向下模拟下坠动画

    $('').each(function(){

      $(this).animate({

        opacity:0;

        top:$(window).height() - $(this).height() - $(this).position().top

      },'slow',function(){ $(this).hide(); })

    })

    基本也就是这样了 好像。。。so  先噶

    重拾梦想 改写人生
  • 相关阅读:
    mysql支持跨表delete删除多表记录
    三种循环的流程图画法总结
    巧用svn create patch(打补丁)方案解决定制版需求
    svn branch and merge(svn切换分支和合并)详解
    visualvm
    Java -verbose[:class|gc|jni] 转 ----JAVA源码分析
    BootstrapClassloader ExtClassloader AppClassloader
    LINUX 源码+内核所有参数说明
    SDN
    人工智能之数学基础
  • 原文地址:https://www.cnblogs.com/wulibo/p/5857349.html
Copyright © 2011-2022 走看看