カラーボックスJSファイル内のメソッドがあります:私は、メソッドの内部術後とposLeft変数を変更したいオーバーロードjQuery Colorboxメソッド?
publicMethod.position = function (speed, loadedCallback) {
var
animate_speed,
// keeps the top and left positions within the browser's viewport.
posTop = Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0)/2 + $window.scrollTop(),
posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0)/2 + $window.scrollLeft();
...more code...
};
が。コアファイルを編集せずにこれらの変数を変更するにはどうすればよいですか?
編集:
私は次のように自分のスクリプトに機能を追加しようとした:
$.fn.colorbox.position = function (speed, loadedCallback) {
...
};
とも:私の変化の
var originalMethod = $.fn.colorbox.position;
$.fn.colorbox.position = function (speed, loadedCallback) {
...
return originalMethod.apply(this, arguments);
};
なしかかわらず機能していません。私もalert($.fn.colorbox.position);
であれば、私の変更も表示されます。私が逃しているものは何ですか?
...あなたは機能を上書きコピー&ペーストする必要がありますと思います。それは "publicMethod"のせいかもしれませんか? – Joker