jquery mootools - CSDN

2020-12-17 CSDN技術社區

mootools

Many of you probably already know this but I like to consider myself a bit of a JavaScript chameleon. If you know that then you probably know I'm a MooTools fanatic that periodically dabbles with jQuery. I'm happy to announce that I was able to join Elijah Manor and Ralph Whitbeck on the jQuery podcast this past week to talk jQuery, MooTools, and web development in general. Head on over to the jQuery blog for more information or iTunes to grab the podcast.

你們中的許多人可能已經知道這一點,但是我想把自己當作JavaScript變色龍。 如果您知道這一點,那麼您可能知道我是MooTools的狂熱者,它定期使用jQuery。 我很高興地宣布,上周我能夠加入Elijah Manor和Ralph Whitbeck的jQuery播客中,討論jQuery,MooTools和一般的Web開發。 請訪問jQuery博客以獲取更多信息,或訪問iTunes以獲得播客 。

As an extension of my podcast appearance, I wanted to share a few code snippets to make your introduction to MooTools or jQuery easier.

作為我播客外觀的擴展,我想分享一些代碼片段,以使您對MooTools或jQuery的介紹更加容易。

特色jQuery和MooTools片段 (Featured jQuery & MooTools Snippets)

一起使用jQuery和MooTools (Using jQuery and MooTools Together)

Did you know that you can use jQuery and MooTools within the same page? It's easy to!

您是否知道可以在同一頁面中使用jQuery和MooTools? 很容易!

<script type="text/javascript" src="moo1.2.4.js"></script><script type="text/javascript" src="jquery-1.4.js"></script><script type="text/javascript">window.addEvent('domready',function() { //moo stuff $('p').css('border','1px solid #fc0'); //jquery});</script>

在MooTools中使用Sizzle (Using Sizzle Within MooTools)

Prefer to use jQuery's selector engine within MooTools? No problem -- here's how:

更喜歡在MooTools中使用jQuery的選擇器引擎? 沒問題-方法如下:

//just as reader "Ryan" mentioned....Window.$$ = function(selector){ return new Elements(new Sizzle(selector));}

jQuery和MooTools連結連結 (jQuery and MooTools Link Nudging)

Link nudging is a classy, subtle effect that makes your websites more dynamic.

連結輕推是一種優雅的,微妙的效果,可讓您的網站更加動態。

/* jquery */$.fn.nudge = function(params) { //set default parameters params = $.extend({ amount: 20, duration: 300, property: 'padding', direction: 'left', toCallback: function() {}, fromCallback: function() {} }, params); //For every element meant to nudge... this.each(function() { //variables var $t = $(this); var $p = params; var dir = $p.direction; var prop = $p.property + dir.substring(0,1).toUpperCase() + dir.substring(1,dir.length); var initialValue = $t.css(prop); /* fx */ var go = {}; go[prop] = parseInt($p.amount) + parseInt(initialValue); var bk = {}; bk[prop] = initialValue; //Proceed to nudge on hover $t.hover(function() { $t.stop().animate(go, $p.duration, '', $p.toCallback); }, function() { $t.stop().animate(bk, $p.duration, '', $p.fromCallback); }); }); return this;};/* jquery usages */$(document).ready(function() { /* usage 1 */ $('#nudgeUs li a').nudge(); /* usage 2 */ $('#nudgeUs2 li a').nudge({ property: 'margin', direction: 'left', amount: 30, duration: 400, toCallback: function() { $(this).css('color','#f00'); }, fromCallback: function() { $(this).css('color','#000'); } });});/* mootols link nudge */window.addEvent('domready',function() { $$('#nudges a').addEvents({ 'mouseenter': function() { this.tween('padding-left',20); }, 'mouseleave': function() { this.tween('padding-left',0); } });});

jQuery和MooTools搜索書籤 (jQuery and MooTools Search Bookmarklets)

These bookmarklets will allow you to highlight text on a page and search the jQuery or MooTools websites to learn more about the phrase.

這些書籤使您可以突出顯示頁面上的文本,並搜索jQuery或MooTools網站以了解有關該短語的更多信息。

jQuery BookmarkletjQuery書籤 MooTools BookmarkletMooTools書籤

 

MooTools中的jQuery事件 (jQuery Events within MooTools)

The following MooTools snippet allows you to use jQuery-style syntax for event listening.

以下MooTools片段允許您使用jQuery樣式的語法進行事件偵聽。

//hash the element.natives so we can do stuff with itvar hash = new Hash(Element.NativeEvents);//remove items that need to be replaced, add their replacementshash.erase('mouseover').erase('mouseout').erase('DOMMouseScroll');hash.include('mouseenter',1).include('mouseleave',1);//initialize thisvar eventHash = new Hash({});//for every event type, add to our hashhash.getKeys().each(function(event){ eventHash[event] = function(fn) { this.addEvent(event,fn); return this; }});//make it happenElement.implement(eventHash);

 

JavaScript FTW! (JavaScript FTW!)

Here are a few other MooTools and jQuery tutorials you may like:

這是您可能喜歡的其他一些MooTools和jQuery教程:

Isn't the JavaScript community great? MooTools FTW!

JavaScript社區不是很好嗎? MooTools FTW!

翻譯自: https://davidwalsh.name/jquery-podcast

mootools

相關焦點

  • jquery ztree入門 - CSDN
    freemaker 模板引擎作為 spring-mvc 展現層》《j2ee 簡單網站搭建:(五)使用 jcaptcha 生成驗證碼圖片》《j2ee 簡單網站搭建:(六)使用 hibernate validation 實現 domain 層實體類驗證》《j2ee 簡單網站搭建:(七)使用 shiro 結合 jcaptcha 實現用戶驗證登錄》《j2ee 簡單網站搭建:(八)使用 jquery-validate
  • jquery.ztree 樣式 - CSDN
    type="text/css"><script type="text/javascript" src="${ctx}/hollybeacon/resources/plugins/zTree_v3/js/jquery.ztree.core
  • JavaScript 學習 jQuery&前端小技巧
    --cdn引入(在線)-->    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.4.1/core.js"></script>     <!
  • jquery 三級聯動插件專題及常見問題 - CSDN
    好了,下面我就來設計這樣的jquery插件吧。2、引入jquery,創建方法我在頁面中使用的是外部連結,https://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js 然後我們來創建一個js文件,命名為 select.js,並引入到頁面中。
  • jquery 社交分享插件專題及常見問題 - CSDN
    iShare 是一款令人驚詫的 jquery  分享和書籤插件。它有許多功能,比如說支持分享到社交網站,支持 shortcode,可選擇激活分享到哪些社交網站,另外還有其他許多可自定義的功能。Social cards 是一個 jquery 插件,它配備了四個分享卡片,包括:Facebook, Twitter, Google Plus, Pinterest, LinkedIn 和入職到粘貼板部件。
  • jquery與js的區別是什麼?js與jquery的用法區別介紹
    在學習js的時候我們肯定能夠接觸到jquery,那麼,js與jquery之間有什麼區別呢?本篇文章將給大家來分享關於jquery與js之間的區別比較,有需要的小夥伴可以參考一下,希望能夠幫助到你們。我們來簡單看一下jquery與js的概念。js是一種腳本語言,常用於網頁客戶端編程,使網頁在客戶端瀏覽器中,實現更多地動態功能,表現出更加豐富的視覺效果。jquery是一個快速、簡潔的JavaScript框架,極大的簡化了javascript編程。
  • jquery實現響應式布局專題及常見問題 - CSDN
    嵌入 jQuery Mobile 框架href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css />jQuery Mobile 框架包括一個 listview 組件,您將使用它顯示您的導航項。
  • JQuery的動畫操作
    人工智慧時代的動畫壹 · JQuery的介紹Write less,Do more1.Jquery是目前使用最為廣泛的javascript函數庫,jquery是一個函數庫,一個js文件,頁面用script標籤引入即可,<script type="text/javascript" src="jquery-3.4.1.js">2.JQuery加載將獲取元素的語句寫到頁面頭部,會因為元素還沒有加載而出錯,就要用ready來進行解決
  • jQuery.each()方法
    <head><meta charset="utf-8"><title>jQuery.each()方法</title><script src="https://cdn.staticfile.org/jquery
  • jQuery學習筆記
    /// w3school教程https://www.w3school.com.cn/jquery/index.asphttps://jquery.com/download/// 第一個為壓縮版本(將複雜的變量名簡化
  • 教程:---《JQuery如何工作》
    前言:我最近在做一個項目,需要用到ajax,我以前做ajax項目,已經有很多年了,jquery還不成熟,需要自己編寫大量的Javascript代碼。最近發現jquery很成熟了,我看了jquery官方的document,我想,如果沒有人翻譯過,我打算邊看文檔,順道邊翻譯。如果有人發現已經有人翻譯過了,勞煩通知一下,我就不做重複勞動了。這裡先提供入門章節內容。
  • jQuery 設置
    下面的例子演示如何改變(設置)連結中 href 屬性的值:實例$("button").click(function(){ $("#w3s").attr("href","//www.w3cschool.cn/jquery"); });嘗試一下 »attr() 方法也允許您同時設置多個屬性
  • JavaScript|jQuery基礎語法
    DOCTYPE html><html><head><meta charset="UTF-8"><title></title><script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"
  • jquery中$的作用與使用方法總結
    使用jquery.js框架使用起來方便多了!突然相起來把以住的學習資料整理一下放在這樣的一個個人知識庫中存儲下來。總體感覺Jquery.js框架最有用,這裡的有用指的就大不了就是使用起來更好理解,更方便,代碼更少,jquery體系中最重要的工具就那個代表國際財富的$!
  • jQuery - each() 方法
    ><head><meta charset="utf-8"><title>菜鳥教程(runoob.com)</title><script src="https://cdn.staticfile.org/jquery
  • jQuery - 鏈(Chaining)
    DOCTYPE html><html><head><meta charset="utf-8"><script src="https://cdn.staticfile.org/jquery/1.10.2
  • JQuery
    滑鼠單擊事件 ondblclick 滑鼠雙擊事件 onblur 元素失去焦點 onfocus 元素獲得焦點 onchange 用戶改變域的內容 使用注意事項:在 jQuery 中將事件封裝成了對應的方法,去掉了JS中的 .on 語法, 例如使用onclick時只需要使用click即可2.2.2 事件的綁定和解綁 綁定事件 jquery
  • jquery attribute vs property 的區別
    bug收集:專門解決與收集bug的網站網址:www.bugshouji.comattribute vs property 的區別property 是 DOM 中的屬性,是 JavaScript 裡的對象;attribute 是 HTML 標籤上的特性,它的值只能夠是字符串jquery
  • 基於 RequireJS 和 jQuery 的模塊化編程——常見問題解析
    中使用jquery插件對於jquery的插件,比較常見的做法都是傳入一個jquery的對象,在這個jquery對象的基礎上添加插件對應的方法。首先需要添加jquery插件的依賴,這裡用兩個插件舉例子——jquery-ui和jquery-datatablesrequirejs.config({    baseUrl: '.