CSMJU jQuery Mobile

เมนู
ถัดไป ก่อนหน้า

4.3 Methods & Utilities

$.mobile.showPageLoadingMsg()

   ยกเลิกใน 1.2 ใช้ $.mobile.loading( 'show' ) แทน
แสดงหน้าเพจโหลดข้อความ ซึ่งเป็นการกำหนดผ่าน $.mobile.loadingMessage

อากิวเมนต์:

theme (string, default: "a") ธีมแถบสำหรับข้อความ

msgText (string, default: "loading") ตัวอักษรสำหรับข้อความ

textonly (boolean, default: false) ถ้าเป็น true การหมุนภาพ จะถูกซ่อนเมื่อข้อความถูกแสดง

ตัวอย่าง


//cue the page loader
$.mobile.showPageLoadingMsg();
//use theme swatch "b", a custom message, and no spinner
$.mobile.showPageLoadingMsg("b", "This is only a test", true);

$.mobile.hidePageLoadingMsg()

ยกเลิกใน 1.2 ใช้ $.mobile.loading( 'hide' ) แทน

   ซ่อนการโหลดข้อความหน้าเพจ ซึ่งกำหนดผ่าน $.mobile.loadingMessage

ตัวอย่าง


//hide the page loader
$.mobile.hidePageLoadingMsg();

$.mobile.fixedToolbars.show()

   ยกเลิกใน 1.1

      ประโยชน์ของเมธอดนี้เพื่อการแสดงความคงที่ในส่วน header หรือไม่ก็ footer ของหน้าเพจที่ใช้งานปัจจุบันภายในการ viewport
Note: ความคงที่ของ headers/footer นั้นไม่สามารถซ่อนได้

อากิวเมนต์

   immediately (boolean, optional) ถ้าเป็น ture ความคงที่ต่างๆของ header หรือ footer สำหรับการทำงานหน้าเพจปัจจุบันจะปรากฏขึ้นทันทีภายใน viewport ถ้าเป็น false หรือ unspecified ความคงที่ของ header/footer จะค่อยๆจางหายไปหลัง 100 มิลลิวินาที


// Show fixed header/footer with a fade animation.
$.mobile.fixedToolbars.show();
// Show fixed header/footer immediately.
$.mobile.fixedToolbars.show(true);

$.mobile.fixedToolbars.hide()

   ยกเลิกใน 1.1

      ประโยชน์เมธอดนี้เพื่อการซ่อนความคงที่ของ header หรือไม่ก็ footer ของการทำงานในหน้าเพจปัจจุบัน

อากิวเมนต์

ตัวอย่าง


// Hide fixed header/footer with a fade animation.
$.mobile.fixedToolbars.hide();
// Hide fixed header/footer immediately.
$.mobile.fixedToolbars.hide(true);
$.mobile.path.parseUrl()

   ประโยชน์ของเมธอดนี้เพื่อแยก URL และตัวแปลที่สัมพันธ์ลงในอ๊อฟเจ็คที่จะทำให้เข้าถึงองค์ประกอบของ URL ได้ง่าย

อากิวเมนต์

   url (string, required) URL แบบความสัมพันธ์ หรือ URL แบบสมบรูณ์

การส่งค่ากลับ

   ฟังก์ชันนี้จะส่งอ๊อฟเจ็คที่มีส่วนประกอบต่างๆของ URL ที่เป็นสตริงกลับคุณสมบัติอ๊อฟเจ็คที่จำลองพื้นที่ของอ๊อฟเจ็คบนบราวน์เซอร์

ตัวอย่าง


// Parsing the Url below results an object that is returned with the
// following properties:
//
//  obj.href:         http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread#msg-content
//  obj.hrefNoHash:   http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread
//  obj.hrefNoSearch: http://jblas:password@mycompany.com:8080/mail/inbox
//  obj.domain:       http://jblas:password@mycompany.com:8080
//  obj.protocol:     http:
//  obj.authority:    jblas:password@mycompany.com:8080
//  obj.username:     jblas
//  obj.password:     password
//  obj.host:         mycompany.com:8080
//  obj.hostname:     mycompany.com
//  obj.port:         8080
//  obj.pathname:     /mail/inbox
//  obj.directory:    /mail/
//  obj.filename:     inbox
//  obj.search:       ?msg=1234&type=unread
//  obj.hash:         #msg-content
var obj = $.mobile.path.parseUrl("http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234");

$.mobile.path.makePathAbsolute()

   ประโยชน์เมธอดนี้สำหรับแปลงพาธรีเลชันของไฟล์หรือไดเรกทอรีให้เป็นพาธสมบูรณ์

อากิวเมนต์

   relPath (string, required) พาธไฟล์หรือไดเรกเทอรีชนิดรีเลชัน

   absPath (string, required) พาธไฟล์สมบูรณ์หรือการแยกความสัมพันธ์พาธ

การส่งค่ากลับ

   ฟังก์ชั่นนี้จะส่งกลับสตริงที่เป็นเวอชันที่สมบูรณ์ให้เข้าไปในรีเลชันพาธ

ตัวอย่าง


// Returns: /a/b/c/file.html
var absPath = $.mobile.path.makePathAbsolute("file.html", "/a/b/c/bar.html");
// Returns: /a/foo/file.html
var absPath = $.mobile.path.makePathAbsolute("../../foo/file.html", "/a/b/c/bar.html");

$.mobile.path.makeUrlAbsolute()

   ประโยชน์เมธอดนี้สำหรับการเปลี่ยนรีเลชัน URL ให้เป็น URL แบบสมบูรณ์

อากิวเมนต์

   relUrl (string, required) ความสัมพันธ์ URL

   absUrl (string, required) แก้ปัญหา URL สมบูรณ์

การส่งค่ากลับ

   ฟังก์ชั่นนี้จะส่งกลับสตริงที่เป็นเวอชันที่สมบูรณ์เข้าไปในความสัมพันธ์ของ URL


// Returns: http://foo.com/a/b/c/file.html
var absUrl = $.mobile.path.makeUrlAbsolute("file.html", "http://foo.com/a/b/c/test.html");
// Returns: http://foo.com/a/foo/file.html
var absUrl = $.mobile.path.makeUrlAbsolute("../../foo/file.html", "http://foo.com/a/b/c/test.html");
// Returns: http://foo.com/bar/file.html
var absUrl = $.mobile.path.makeUrlAbsolute("//foo.com/bar/file.html", "http://foo.com/a/b/c/test.html");
// Returns: http://foo.com/a/b/c/test.html?a=1&b=2
var absUrl = $.mobile.path.makeUrlAbsolute("?a=1&b=2", "http://foo.com/a/b/c/test.html");
// Returns: http://foo.com/a/b/c/test.html#bar
var absUrl = $.mobile.path.makeUrlAbsolute("#bar", "http://foo.com/a/b/c/test.html");