日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

移动开发框架,第【一】弹:QuoJs 官方文档(汉化版)

發布時間:2024/4/17 编程问答 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 移动开发框架,第【一】弹:QuoJs 官方文档(汉化版) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

作者:一只猿

原文地址:

http://www.92ez.com

轉載請注明出處,謝謝

幫助說明

如果您認為QuoJS只是一個觸摸事件管理器,那你就錯了,它是一個功能豐富的類庫,無需第三方JavaScript庫(例如 jQuery, Prototype, Kendo ...)來創建基于瀏覽器應用程序的復雜項目。

?

項目地址:http://quojs.tapquo.com/


如何使用
QuoJS使用的命名空間是$$,所以如果你需要的話,你還可以使用其它的JavaScript類庫例如(jQuery,Zepto...)使用通用符號$。

// Find all <span> elements in <p> elements $$('span', 'p');//Subscribe to a tap event with a callback $$('p').tap(function() {// affects "span" children/grandchildren$$('span', this).style('color', 'red'); });// Chaining methods $$('p > span').html('tapquo').style('color', 'blue');

查詢方法
QuoJs有DOM元素查詢引擎與其它著名的類庫非常相似.你已經使用的jQuery的很多方法在這里都可以使用.

// jQuery的支持的查詢方 .get(index) .find('selector') .parent() .siblings('selector') .children('selector') .first() .last() .closest('selector') .each(callback)

元素方法
QuoJs有DOM元素查詢引擎與其它著名的類庫非常相似.你已經使用的jQuery的很多方法在這里都可以使用.

// Get/Set element attribute .attr('attribute') .attr('attribute', 'value') .removeAttr('attribute') // Get/Set the value of the "data-name" attribute .data('name') .data('name', 'value') // Get/Set the value of the form element .val() .val('value') // Show/Hide a element .show() .hide() // get object dimensions in px .offset('selector') .height() .width() // remove element .remove()

樣式方法
QuoJS可以輕松管理你任何DOM元素的CSS樣式,這些方法很箱子,你很容易記住所有的CSS方法

// set a CSS property .style('css property', 'value')// add/remove a CSS class name .addClass('classname') .removeClass('classname') .toggleClass('classname') // returns true of first element has a classname set .hasClass('classname') // Set a style with common vendor prefixes .vendor('transform', 'translate3d(50%, 0, 0)');$$('article').style('height', '128px'); $$('article input').addClass('hide');var houses = $$('.house'); if (houses.hasClass('ghost')) {houses.addClass('buuhh'); } DOM操作方法 這些方法允許我們插入/更新現有的元素,里面的內容。 // get first element's .innerHTML .html() // set the contents of the element(s) .html('new html') // get first element's .textContent .text() // set the text contents of the element(s) .text('new text') // add html (or a DOM Element) to element contents .append(), prepend() // If you like set a new Dom Element in a existing element .replaceWith() // Empty element .empty()$$('article').html('tapquo'); var content = $$('article').html(); //content is 'tapquo' 事件處理 每一個前端項目需要一個高效的事件管理,你可以創建自己的活動,以及現有的訂閱。 // add event listener to elements .on(type, [selector,] function); // remove event listener from elements .off(type, [selector,] function); // triggers an event .trigger(type); //If loaded correctly all resources .ready(function);// Subscribe for a determinate event $$(".tapquo").on("tap", function); // Trigger custom event $$(".quojs").trigger("loaded"); // Loaded page $$.ready(function() {alert("QuoJS rulz!"); });

手勢事件
既然QuoJs支持瀏覽器的觸摸事件,那么你有無數的事件和手勢來幫助你做任何一個項目

//Tap event, common event .tap(function); //Long tap event (650 miliseconds) .hold(function); //A tap-delay event to combine with others events .singleTap(function); //If you send two singleTap .doubleTap(function);

滑動方法
不僅有基本的滑動方法,常見的應用程序中有很多的滑動你都可以使用

.swipe(function); //Detect if is swipping .swiping(function); //Swipe directions .swipeLeft(function); .swipeRight(function); .swipeDown(function); .swipeUp(function);

捏方法(類似iphone圖片縮小的手勢?)

As with the previous gesture, QuoJS have easy control over this gesture and its variations. .pinch(function); //Detect if is pinching .pinching(function); //Pinch zoom .pinchIn(function); .pinchOut(function);

旋轉方法(Rotate methods)

.rotate(function); //Detect if is rotating .rotating(function); //Rotate directions .rotateLeft(function); .rotateRight(function);

Ajax方法

$$.get(url, [parameters], [callback], [mime-type]); $$.post(url, [parameters], [callback], [mime-type]); $$.put(url, [parameters], [callback], [mime-type]); $$.delete(url, [parameters], [callback], [mime-type]); $$.json(url, [parameters], [callback]);$$.json(url, {id: 1980, user: 'dan'}, function(data){ ... });$$.ajax({type: 'POST', // defaults to 'GET'url: 'http://rest',data: {user: 'soyjavi', pass: 'twitter'},dataType: 'json', //'json', 'xml', 'html', or 'text'async: true,success: function(response) { ... },error: function(xhr, type) { ... } }); //Default Settings $$.ajaxSettings = {async: true,success: {},error: {},timeout: 0 };//Set de default timeout to 1 second (1000 miliseconds) $$.ajaxSettings.timeout = 1000;//Set de default callback when ajax request failed $$.ajaxSettings.error = function(){ ... };$$.ajaxSettings.async = false; var response = $$.json('http://', {id: 1980, user: 'dan'});

環境事件
The environment object contains useful information to learn more about your device.

var env = $$.environment();env.browser //[STRING] Browser of your mobile device env.isMobile //[BOOLEAN] env.os.name //[STRING] iOS, Android, Blackberry... env.os.version //[STRING] Versión of OS env.screen //[OBJECT] With properties: width & height

?


轉載于:https://www.cnblogs.com/cydmk/archive/2013/05/10/3070497.html

總結

以上是生活随笔為你收集整理的移动开发框架,第【一】弹:QuoJs 官方文档(汉化版)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。