Rails / views/show.html.erbで使用されているJavascriptのグローバル変数を削除しています
私が使用しているJavaScriptは
var App = {};
App.UserSnapShot = function () {
var _body, _detailEl, _selectedLinkEl;
var _init = function () {
_body = $$("body")[0];
$$(".user-link").each(function (el) {
el.observe("mouseover", function (event) {
_selectedLinkEl = el;
_detailEl = event.element().next();
_detailEl.show();
_body.observe("mouseover", _bodyMouseOverFunction);
});
});
};
var _bodyMouseOverFunction = function (event) {
if (event.element() != _selectedLinkEl &&
event.element() != _detailEl &&
!event.element().ancestors().include(_detailEl)) {
_detailEl.hide();
_body.stopObserving("mouseover", _bodyMouseOverFunction);
}
};
return {
init: function () {
_init();
}
};
}();
同じ..のonready関数を介して関数App.UserSnapShot.init();を呼び出す必要があります。これを機能させるには、..ここにonReady関数を追加するにはどうすればよいですか。
plsはいくつかの提案をします