ラベル jquery の投稿を表示しています。 すべての投稿を表示
ラベル jquery の投稿を表示しています。 すべての投稿を表示

2013年1月28日月曜日

new and not new

x() instanceof x と new x() instanceof x を同時に満たすような x の作り方。

var x = (function () {
    var constructor = function (args) {
        /* constructor */
    };

    /* other definitions */

    var exports = function (args) {
        return new constructor(args);
    };

    constructor.prototype.constructor = exports;
    exports.prototype = constructor.prototype;

    return exports;
}());

とやると、x() instanceof x && new x() instanceof x となる。

jQuery も似たような事やってる。https://github.com/jquery/jquery/blob/master/src/core.js

2009年9月24日木曜日

fancybox の角の×を消す。

fancybox.css の中で、

div#fancy_close の中に、

visibility: hidden;

プロパティを追加。
同様に、div#fancy_title に visibility: hidden を追加して、タイトルを消す事も出来る。