组织原型javascript,同时维护对象引用和继承
Carousel.prototype.next = function () {...}Carousel.prototype.prev = function () {..}Carousel.prototype.bindControls = function () {..}Carousel.prototype.controls = {
next: function () { ... } ,
prev: function() { ... },
bindControls: function () { .. }}BigCarousel.prototype.next = function () {...}Function.prototype.inheritsFrom = function (parentClass) {
if (parentClass.constructor === Function) {
//Normal Inheritance
this.prototype = $.extend(this.prototype , new parentClass);
this.prototype.constructor = this;
this.prototype.parent = parentClass.prototype;
}
else {
//Pure Virtual Inheritance
this.prototype = $.extend(this.prototype, parentClass);
this.prototype.constructor = this;
this.prototype.parent = parentClass;
}
return this;};BigCarousel.inheritsFrom(Carousel)
杨魅力
随时随地看视频慕课网APP
相关分类