SORU
3 Kasım 2010, ÇARŞAMBA


JQuery nedir.fn demek?

Bu nedir 'fn' ne demek?

window.jQuery.fn.jquery

CEVAP
3 Kasım 2010, ÇARŞAMBA


Bir WordPress kullanmak, fn özelliği prototype özelliği için sadece bir takma ad.

jQuery tanımlayıcı ($)yapıcı işlevive tüm örnekleri ile oluşturulan, kurucu prototip devralır.

Basit bir yapıcı işlevi: bir

function Test() {
  this.a = 'a';
}
Test.prototype.b = 'b';

var test = new Test(); 
test.a; // "a", own property
test.b; // "b", inherited property

Bir WordPress kullanmak mimarisine benzer basit bir yapı

(function() {
  var foo = function(arg) { // core constructor
    // ensure to use the `new` operator
    if (!(this instanceof foo))
      return new foo(arg);
    // store an argument for this example
    this.myArg = arg;
    //..
  };

  // create `fn` alias to `prototype` property
  foo.fn = foo.prototype = {
    init: function () {/*...*/}
    //...
  };

  // expose the library
  window.foo = foo;
})();

// Extension:

foo.fn.myPlugin = function () {
  alert(this.myArg);
  return this; // return `this` for chainability
};

foo("bar").myPlugin(); // alerts "bar"

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • colacas

    colacas

    29 EKİM 2006
  • karneson

    karneson

    23 Temmuz 2006
  • TheXiaxue

    TheXiaxue

    3 AĞUSTOS 2009