[APP] APP Framework Quickstart

Source: Internet
Author: User

---------------------------------------------------------------------------------------------------------

When using the app Framework, you can only use the available selectors. You can go to the full list. Custom pseudo-selectors created in jquery are not supported. Here are some examples of how the app framework can help you accelerate your development.

The first step is to introduce the app framework to your page.

<script src= "//cdn.app-framework-software.intel.com/2.1/appframework.min.js" type= "Text/javascript" ></ Script>

The APP framework works by adding elements to a "bucket". All the elements in the "bucket" can take advantage of the special app Framework API approach to help speed up your development.

Using the app Framework, you first call the $ () method that contains a parameter. This parameter can be one of the following.

    • String-This can be an ID element "#id", the class name ". Foo", a consortium "#id. Foo", or an HTML string to create an object "<div id= ' foo ' ></div>"
    • Element-This will create a new app framework object and add elements to the "bucket".
    • Arrays/objects-This creates a new app framework object and adds options to the bucket.
    • Method-When the domcontentloaded is triggered or immediately after that, it executes a method.

You can also pass an additional parameter "Context" to allow you to search/filter.

Here are some of the base samples for finding elements.

// find the element with id= "foo"; $ (//Find all the divs on thepage; $ (//Find all elements, that has theclassname = "foo"; $ (//Find all span ' s. exist inside the element with id= "foo"

Below, we find all the list elements (<li>) and add a "Foo" class to them.

$ ("Li"). addclass ("foo");

Here we find an "foo" element by ID and hide it.

$ ("#foo"). Hide ();

Here we look for all the DOM with the class name "Removeme" and remove it.

$ (". Removeme"). Remove ();

Let's look at some of the more advanced things we can do. Below, we will create a div, append it to the body and register a click event.

var div=$ ("<div id=" \ "mynewdiv\" "" >this is some content</div> ");    $ (document.body). Append (div);    Div.bind ("click",function() {    alert ("I was clicked");});

@ Black eyed poet <www.chenwei.ws>

Translated from: Http://app-framework-software.intel.com/documentation.php#intro/quickstart

[APP] APP Framework Quickstart

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.