---------------------------------------------------------------------------------------------------------
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