我目前是 Mootools 初学者(今天开始学习)。我来自 jQuery。我了解了 Element.Implement
。
我正在尝试将 .ready 函数从 jquery 添加到 mootools。
Jquery.ready 示例:
$(document).ready(function(){
//Do stuff onload
});
我正在尝试用这样的 mootools 来做到这一点:
Element.implement({
ready: function(a){
return this.addEvent('domready', a)
}
});
但正如我所说。我是 mootools 初学者,我不会调试它。
我这样做是因为我喜欢所有的 jquery 函数。我习惯了他们的名字。但我喜欢 mootools 比 jquery 有一些优势。而且我知道我可以同时使用两者。但这太复杂了
最佳答案
只需这样做:
function domready(domreadycode){
window.addEvent('domready', domreadycode);
}
并像这样使用它:
domready(function(){
//code when document is ready
});
关于javascript - 让 Mootools 更适合 Jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8650273/