Coder Social home page Coder Social logo

my-fm-2018-9-13's Introduction

init中需要完成的事情

  1. init先获取事件,比如this.$footer = $(footer)
  2. this.bind()绑定事件
  3. this.render()渲染页面

jQuery事件监听获取数据

var eventCenter = {
    on:function(type,handler){
        $(document).on(type,handler);
    },
    fire:function(type,data){
        $(document).trigger(type,data);
    }
}

//当监听 xxx 的时候,打印 niao
eventCenter.on('xxx',function(e,data){
	console.log('xxx',data)
})
eventCenter.fire('xxx','niao')

jQuery API

  1. .html()有两种用法,第1种是获取匹配元素的 HTML 内容,第二种是设置匹配元素的 HTML 内容,要字符串的形式。
  2. .find()通过一个选择器,jQuery对象,得到当前匹配的元素集合中的相应 。
  3. .getJSON(string)通过 HTTP GET 请求从服务器获取 JSON 编码。
  4. deferred.done(function)deferred.fail(function)异步处理函数,成功时执行.done()里面的内容,失败后执行.fail()里面的内容。
  5. .length得到匹配元素的数量。
  6. outerWidth([includeMargin])可获取匹配元素的宽度,包括paddingborder和选择性的margin,如果括号中是true,获取的宽度包含margin。要注意获得的宽度是不包含px单位的。
  7. .attr(attributeName[,value])获得匹配元素的属性名称的值,加上value可以设置匹配元素的属性名称的值。
  8. .animation(properties[,duration][,easing][,function]),propertes是 CSS 的 valuekeyduration是持续的事件,easing是过度动画,function动画完成时需要执行的函数。

my-fm-2018-9-13's People

Contributors

astak16 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.