mootools

    技术2022-07-11  80

    mootools

    I've updated this post's content per reader comments. Thanks to everyone for their suggestions!

    我已根据读者评论更新了该帖子的内容。 感谢大家的建议!

    While I prefer the MooTools syntax over the jQuery syntax, I do respect the jQuery syntax. Here's a quick way to make your MooTools look a little like jQuery by implementing the Element.click() function.

    尽管我更喜欢MooTools语法而不是jQuery语法,但我确实尊重jQuery语法。 这是一种通过实现Element.click() 函数使MooTools看起来像jQuery的快速方法。

    MooTools JavaScript (The MooTools JavaScript)

    Element.implement({ 'click': function(fn) { return this.addEvent('click',fn); } });

    MooTools JavaScript用法 (The MooTools JavaScript Usage)

    window.addEvent('domready',function() { //show an alert when the element is clicked. $('click-me').click(function() { alert('Clicked'); }); });

    This syntax will allow for shorter code if you do a lot of click event programming.

    如果您进行了大量click事件编程,则此语法将允许使用较短的代码。

    翻译自: https://davidwalsh.name/implement-jquery-click-syntax-mootools

    mootools

    相关资源:jdk-8u281-windows-x64.exe
    Processed: 0.031, SQL: 9