I think the following codes would be useful when I want to make iDangerous swiper responsive to toggle mode between vertical and horizontal.
CSS3 :
@media screen and (orientation:landscape)
{
body
{
background: red;
}
}
@media screen and (orientation:landscape)
{
body
{
background: red;
}
}
[array].sort(function(a, b){ var nameA=a.name.toLowerCase(), nameB=b.name.toLowerCase() if (nameA < nameB) //sort string ascending return -1 if (nameA > nameB) return 1 return 0 //default return value (no sorting) });
A Polyfill providing a simple name:value syntax for client-side data storage, which uses IndexedDB in the background, but falls back to WebSQL and then localStorage in browsers that don't support IndexedDB.
/***************************************************************************** Ref: http://www.dexie.org/ Starting point: http://rawgit.com/dfahlander/Dexie.js/master/samples/codeproject-article/DexieAlgorithmsSamples.html http://blog.nparashuram.com/2012/10/indexeddb-example-on-cordova-phonegap_12.html http://nparashuram.com/IndexedDBShim/ *****************************************************************************/ // // App global database instance and schema // var db = new Dexie("MyDB"); db.version(1).stores({ friends: "++id,name,shoeSize" }); db.open(); // // Populate some data // function populateSomeData() { log("Populating some data", "heading"); return db.transaction("rw", db.friends, function () { // objectStore?? db.friends.clear(); db.friends.add({ name: "David", shoeSize: 43 }); db.friends.add({ name: "Ylva", shoeSize: 37 }); db.friends.add({ name: "Jon", shoeSize: 44 }); db.friends.add({ name: "Måns", shoeSize: 42 }); db.friends.add({ name: "Daniel", shoeSize: 39 }); db.friends.add({ name: "Nils", shoeSize: 45 }); db.friends.add({ name: "Zlatan", shoeSize: 47 }); // Log data from DB: db.friends.orderBy('name').each(function (friend) { log(JSON.stringify(friend)); }); }).catch(function (e) { log(e, "error"); }); } // Query Example db.friends.where('name').equalsIgnoreCase('david') .each(function (friend) { log(JSON.stringify(friend)); }); // Modify db.friends.where('name').equalsIgnoreCase('david') // query (read) only .each(function (friend) { log(JSON.stringify(friend)); }); db.transaction("rw", db.friends, function () { // read (query) & modify db.friends.where("name").equalsIgnoreCase('david').modify({shoeSize: 100}); })
$("document").ready( function() {
$('table').each(function(){
$(this).prepend('')
$(this).find('thead').append($(this).find("tr:eq(0)"));
})});
var myTable = jQuery("#myTable");
var thead = myTable.find("thead");
var thRows = myTable.find("tr:has(th)");
if (thead.length===0){ //if there is no thead element, add one.
thead = jQuery("").appendTo(myTable);
}
var copy = thRows.clone(true).appendTo("thead");
thRows.remove();
If you're calling requestFileSystem()
for the first time, new storage is created for your app. It's important to remember that this file system is sandboxed, meaning one web app cannot access another app's files. This also means you cannot read/write files to an arbitrary folder on the user's hard drive (for example My Pictures, My Documents, etc.).