SlideShare a Scribd company logo
jQuery Mobile part 2
Gary
2014/1/8
Outline
• jQuery Mobile and JavaScript
• Document Event
• Configuration
• Method and Utility
• Theme
• App Package
Document Event
• Unlike other jQuery projects, such as jQuery and jQuery UI, jQuery
Mobile automatically applies many markup enhancements as soon as
it loads
• The sequence of document event
• mobileinit
• ready
• load
<script src="jquery.js"></script>
<script>
$(document).bind('mobileinit', function(){
$.mobile.ajaxEnabled=false;
});
</script>
<script src="jquery-mobile.js"></script>
Configuration
• Global
• UI
• AJAX
• Regionalization
• Touch overflow
• Page
• Page loading
• Widget
Configuration - UI
• activeBtnClass string, default: "ui-btn-active"
• The CSS class used for "active" button state.
• activePageClass string, default: "ui-page-active"
• The CSS class used for the page currently in view or in a transition.
• minScrollBack integer, default: 250
• Minimum scroll distance that will be remembered when returning to a page.
• defaultDialogTransition string, default: 'pop'
• Set the default transition for dialog changes that use Ajax. Set to 'none' for no
transitions.
Configuration - AJAX
• When jQuery Mobile attempts to load an external page, the request
runs through $.mobile.loadPage(). This will only allow cross-domain
requests if $.mobile.allowCrossDomainPages is set to true.
• jQuery Mobile framework tracks what page is being viewed within the
browser's location hash, it is possible for a cross-site scripting (XSS)
attack to occur if the XSS code in question can manipulate the hash
and set it to a cross-domain URL of its choice. This is the main reason
that the default setting for $.mobile.allowCrossDomainPages is set to
false.
Configuration - Regionalization
• Hard-coded
//Global String
$.mobile.loadingMessage = “loading”;
$.mobile.pageLoadErrorMessage = “Error Loading Page”
//Widget String
$.mobile.page.prototype.options.backBtnText = “Back”;
$.mobile.dialog.prototype.options.closeBtnText = “Close”;
//Global String
$.mobile.loadingMessage = “cargando”;
$.mobile.pageLoadErrorMessage = “Error Cargando Página”
//Widget String
$.mobile.page.prototype.options.backBtnText = “Atrás”;
$.mobile.dialog.prototype.options.closeBtnText = “Cerrar”;
Deprecated
$( document ).bind( 'mobileinit', function(){
$.mobile.loader.prototype.options.text = "loading";
$.mobile.loader.prototype.options.textVisible = false;
$.mobile.loader.prototype.options.theme = "a";
$.mobile.loader.prototype.options.html = "";
});
Configuration– Touch Overflow
• A feature called touchOverflowEnabled
is designed to leverage the upcoming
wave of browsers that support overflow
scrolling in CSS.
Page
Header
Footer
Content
<head>
<body>
<script>
$(document).bind("mobileinit", function(){
$.mobile.touchOverflowEnabled = true;
});
</script>
Deprecated
Scrolling area
Configuration - Page
• Configuration of page
• Configuration of loading page
• Whenever loading external pages using AJAX, some default attributes are
applied
• Change loading page attributes once, not every time
$(document).bind(‘mobileinit’, function(){
$.mobile.page.prototype.options.addbackbtn = true;
$.mobile.page.prototype.options.backBtnTheme = “e”;
$.mobile.page.prototype.options.headerTheme = “b”;
$.mobile.page.prototype.options.footerTheme = “d”;
});
$.mobile.loadPage.defaults
$.mobile.changePage
Configuration - Widgets
• Every widget in jQuery Mobile has its own default configuration
• We can modify the option objects of widget’s prototype
• Every widget supports theme default attributes
$(document).bind(‘mobileinit’, function(){
$.mobile.listview.prototype.filter = true;
$.mobile.selectmenu.prototype.nativeMenu = false;
});
Method and Utility
• Data-*
• Page
• Platform
• Path
• UI
Method and Utility – Data-*
• $.fn.jqmData(), $.fn.jqmRemoveData()
• When working with jQuery Mobile, jqmData and jqmRemoveData
should be used in place of jQuery core's data and removeData
methods , as they automatically incorporate getting and setting of
namespaced data attributes (even if no namespace is currently in use).
• In jQuery
• In jQuery Mobile
$("div[data-role='page']")
$("div:jqmData(role='page')") $("div[data-"+ $.mobile.ns +"role='page']")
Method and Utility – Page
• $.mobile.activePage()
• Reference to the page currently in view.
• $.mobile.changePage()
• Programmatically change from one page to another. This method is used
internally for the page loading and transitioning that occurs as a result of
clicking a link or submitting a form, when those features are enabled.
$.mobile.changePage(“external.html”);
$mobile.changePage($(“#pageId”));
Method and Utility – Page
• The second non-essential argument
$.mobile.changePage($(“#page2”), {
transition: “slide”,
reverse: true
});
<script>
function viewProduct(idProduct){
$.mobile.changePage(“productdetail.php”, {
method: “post”,
data: {
action: ‘getproduct’,
id: idProduct
},
transition: “fade”
});
}
</script>
Method and Utility – Platform
• The framework provides some platform utilities to web development
function clickbtn2(){
$gradeA2 = $.mobile.gradeA();
$getScreenHeight2 = $.mobile.getScreenHeight();
$getGradeA = $("#show").val("id");
$getGradeA.html($getScreenHeight2);
if ($gradeA2){
alert("it's true");
}
}
Method and Utility – Platform
• $.mobile.path.parseUrl()
• Utility method for parsing a URL and its relative variants into an object that makes accessing the
components of the URL easy. When parsing relative variants, the resulting object will contain empty
string values for missing components (like protocol, host, etc).
// 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);
Method and Utility - UI
• $.mobile.silentScroll()
• Scroll to a particular Y position without triggering scroll event listeners.
• $.mobile.showPageLoadingMsg()
• Show the page loading message, which is configurable via $.mobile.loadingMessage
• $.mobile.hidePageLoadingMsg()
• Hide the page loading message, which is configurable via $.mobile.loadingMessage.
$.mobile.showPageLoadingMsg();
setTimeout(function() {
$.mobile.hidePageLoadingMsg();
}, 2000);
$.mobile.loading('show');
setTimeout(function() {
$.mobile.loading(‘hide');
}, 2000);
Deprecated
Theme
• The theming system used in jQuery Mobile is similar to the ThemeRoller system in
jQuery UI with a few important improvements:
• CSS3 properties
• rounded corners, box and text shadow and gradients
• lightweight and reducing server requests.
• Multiple color "swatches" — each consisting of
• a header bar, content body, and button states
• make richer designs possible.
• Open-ended theming
• 26 unique swatches per theme
• CSS3 gradients
• reduce file size and number of server requests.
• Simplified icon set
• reduce image weight.
Theme
• The easiest way to create custom themes is with the ThemeRoller tool.
It allows you to build a theme, then download a custom CSS file,
ready to be dropped into your project.
• If no theme swatch letter is set at all, the framework uses the "a"
swatch (black in the default theme) for headers and footers and the
"c" swatch (light gray in the default theme) for the page content to
maximize contrast between the both.
Theme
swatch color selector
Palette pane
Preview Pane
Theme
Theme
Theme
<link rel="stylesheet" href="css/themes/test.css" />
<link rel="stylesheet" href="css/themes/jquery.mobile.icons.min.css" />
…
<div data-role="page" id="pagetwo" data-theme="c">
App Package
• Native app
• Installed through an application store (such as Google Play or Apple’s App Store)
• Developed specifically for one platform
• Can take full advantage of all the device features
• Web app
• Not real apps
• Websites that, in many ways, look and feel like native applications.
• Run by a browser and typically written in HTML5
• Hybrid app
• Part native apps, part web apps.
• Live in an app store
• Rely on HTML being rendered in a browser
App Package – Native App
• Pros
• Be able to access all the features of the phone (GPS, camera, etc.)
• Better run speed, performance and overall user experience
• Support for offline work
• Rich graphics and animation
• Can be found easily at app store
• The app icons are shown on the screen
• Download an app need to pay
• Cons
• More limits (specific operating system)
• Unknown deployment time (app store approval process)
• Content Restrictions (app store restrictions)
• User must update manually
App Package – Web App
• Pros
• Wide range of devices (almost all smart phones)
• Low development costs
• Deploy quickly and easily
• No content restrictions
• Users always access to the latest version
• Cons
• Poorer performance and user experience
• Poor graphics and animation support
• Does not apply to the app store
• Have to connect with Internet
• Restrict some functions (GPS, camera, etc.)
App Package – Hybrid App
• Pros
• Support multi-platform access
• Phone functions are accessible
• Suitable for applications store
• Partial support offline
• Cons
• Unknown deployment time
• User experience is not as good as using native apps
• Not very mature technology
App Package
• Phonegap
• a free and open source framework that allows you to create mobile apps
using standardized web APIs for the platforms you care about.
• appMobi
• Cross platform push messaging, app promotion, in-app purchasing, integrated
analytics and more, for all applications and deployed in any environment.
App Package
• Need adobe or github account
App Package
App Package
• Run on Android phone
Conclusion
• PhoneGap is an HTML5 app platform that allows developers to author
native applications with web technologies and get access to APIs and
app stores.
• Applications are built as normal HTML pages and packaged up to run
as a native application within a UIWebView or WebView (a
chromeless browser).

More Related Content

What's hot

Introduction to jquery mobile with Phonegap
Introduction to jquery mobile with PhonegapIntroduction to jquery mobile with Phonegap
Introduction to jquery mobile with Phonegap
Rakesh Jha
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
FITC
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
crokitta
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
Jennifer Bourey
 
Modular applications with montage components
Modular applications with montage componentsModular applications with montage components
Modular applications with montage components
Benoit Marchant
 
DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalCampDN
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideSPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuide
Mark Rackley
 
uMobile Preconference Seminar
uMobile Preconference SeminaruMobile Preconference Seminar
uMobile Preconference Seminar
Jennifer Bourey
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360FlexBuilding iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flex
danielwanja
 
OttawaJS: angular accessibility
OttawaJS: angular accessibilityOttawaJS: angular accessibility
OttawaJS: angular accessibility
Derek Featherstone
 
Javascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web AppsJavascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web Apps
dnelson-cs
 
AngularJS
AngularJSAngularJS
Once Source to Rule Them All
Once Source to Rule Them AllOnce Source to Rule Them All
Once Source to Rule Them All
David Yeiser
 
Web Components v1
Web Components v1Web Components v1
Web Components v1
Mike Wilcox
 
Native look and feel bbui & alicejs
Native look and feel bbui & alicejsNative look and feel bbui & alicejs
Native look and feel bbui & alicejs.toster
 
Building rich Single Page Applications (SPAs) for desktop, mobile, and tablet...
Building rich Single Page Applications (SPAs) for desktop, mobile, and tablet...Building rich Single Page Applications (SPAs) for desktop, mobile, and tablet...
Building rich Single Page Applications (SPAs) for desktop, mobile, and tablet...
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 

What's hot (20)

Introduction to jquery mobile with Phonegap
Introduction to jquery mobile with PhonegapIntroduction to jquery mobile with Phonegap
Introduction to jquery mobile with Phonegap
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
 
Responsive Web Site Design
Responsive Web Site DesignResponsive Web Site Design
Responsive Web Site Design
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 
Modular applications with montage components
Modular applications with montage componentsModular applications with montage components
Modular applications with montage components
 
DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideSPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuide
 
uMobile Preconference Seminar
uMobile Preconference SeminaruMobile Preconference Seminar
uMobile Preconference Seminar
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360FlexBuilding iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flex
 
OttawaJS: angular accessibility
OttawaJS: angular accessibilityOttawaJS: angular accessibility
OttawaJS: angular accessibility
 
Javascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web AppsJavascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web Apps
 
AngularJS
AngularJSAngularJS
AngularJS
 
Once Source to Rule Them All
Once Source to Rule Them AllOnce Source to Rule Them All
Once Source to Rule Them All
 
jQuery Mobile UI
jQuery Mobile UIjQuery Mobile UI
jQuery Mobile UI
 
Web Components v1
Web Components v1Web Components v1
Web Components v1
 
Anex.......
Anex.......Anex.......
Anex.......
 
Native look and feel bbui & alicejs
Native look and feel bbui & alicejsNative look and feel bbui & alicejs
Native look and feel bbui & alicejs
 
Building rich Single Page Applications (SPAs) for desktop, mobile, and tablet...
Building rich Single Page Applications (SPAs) for desktop, mobile, and tablet...Building rich Single Page Applications (SPAs) for desktop, mobile, and tablet...
Building rich Single Page Applications (SPAs) for desktop, mobile, and tablet...
 

Viewers also liked

JQuery mobile
JQuery mobileJQuery mobile
JQuery mobile
Gary Yeh
 
Git Workflow
Git WorkflowGit Workflow
Git Workflow
Gary Yeh
 
Linux Char Device Driver
Linux Char Device DriverLinux Char Device Driver
Linux Char Device Driver
Gary Yeh
 
Servlet and JSP
Servlet and JSPServlet and JSP
Servlet and JSP
Gary Yeh
 
Database and Java Database Connectivity
Database and Java Database ConnectivityDatabase and Java Database Connectivity
Database and Java Database Connectivity
Gary Yeh
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsBasic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
Gary Yeh
 
JQuery UI
JQuery UIJQuery UI
JQuery UI
Gary Yeh
 
Introduction of openGL
Introduction  of openGLIntroduction  of openGL
Introduction of openGL
Gary Yeh
 
Run-time of Node.js : V8 JavaScript Engine
Run-time of Node.js: V8 JavaScript EngineRun-time of Node.js: V8 JavaScript Engine
Run-time of Node.js : V8 JavaScript Engine
Gary Yeh
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript Engine
Kris Mok
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvas
Gary Yeh
 

Viewers also liked (11)

JQuery mobile
JQuery mobileJQuery mobile
JQuery mobile
 
Git Workflow
Git WorkflowGit Workflow
Git Workflow
 
Linux Char Device Driver
Linux Char Device DriverLinux Char Device Driver
Linux Char Device Driver
 
Servlet and JSP
Servlet and JSPServlet and JSP
Servlet and JSP
 
Database and Java Database Connectivity
Database and Java Database ConnectivityDatabase and Java Database Connectivity
Database and Java Database Connectivity
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsBasic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
 
JQuery UI
JQuery UIJQuery UI
JQuery UI
 
Introduction of openGL
Introduction  of openGLIntroduction  of openGL
Introduction of openGL
 
Run-time of Node.js : V8 JavaScript Engine
Run-time of Node.js: V8 JavaScript EngineRun-time of Node.js: V8 JavaScript Engine
Run-time of Node.js : V8 JavaScript Engine
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript Engine
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvas
 

Similar to jQuery Mobile and JavaScript

Multi screen HTML5
Multi screen HTML5Multi screen HTML5
Multi screen HTML5
Ron Reiter
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Sean Burgess
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Doris Chen
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
toddbr
 
Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)
Adam Lu
 
Refactor Large apps with Backbone
Refactor Large apps with BackboneRefactor Large apps with Backbone
Refactor Large apps with Backbone
devObjective
 
Refactor Large applications with Backbone
Refactor Large applications with BackboneRefactor Large applications with Backbone
Refactor Large applications with Backbone
ColdFusionConference
 
Refactoring Large Web Applications with Backbone.js
Refactoring Large Web Applications with Backbone.jsRefactoring Large Web Applications with Backbone.js
Refactoring Large Web Applications with Backbone.js
Stacy London
 
SPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuerySPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuery
Mark Rackley
 
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePointSPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
Mark Rackley
 
An Introduction to webOS
An Introduction to webOSAn Introduction to webOS
An Introduction to webOSKevin Decker
 
Cordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web SkillsCordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web Skills
Clay Ewing
 
HTML5 on Mobile
HTML5 on MobileHTML5 on Mobile
HTML5 on Mobile
Adam Lu
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen Lju
Skills Matter
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen LjuSkills Matter
 
jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobilemowd8574
 
ADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
ADF Mobile: 10 Things you don't get from the developers guide - Luc BorsADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
ADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
Getting value from IoT, Integration and Data Analytics
 
ADF Mobile: 10 Things you don't get from the developers guide
ADF Mobile: 10 Things you don't get from the developers guideADF Mobile: 10 Things you don't get from the developers guide
ADF Mobile: 10 Things you don't get from the developers guide
Luc Bors
 
Mini-Training: AngularJS
Mini-Training: AngularJSMini-Training: AngularJS
Mini-Training: AngularJS
Betclic Everest Group Tech Team
 

Similar to jQuery Mobile and JavaScript (20)

Multi screen HTML5
Multi screen HTML5Multi screen HTML5
Multi screen HTML5
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)
 
Refactor Large apps with Backbone
Refactor Large apps with BackboneRefactor Large apps with Backbone
Refactor Large apps with Backbone
 
Refactor Large applications with Backbone
Refactor Large applications with BackboneRefactor Large applications with Backbone
Refactor Large applications with Backbone
 
Refactoring Large Web Applications with Backbone.js
Refactoring Large Web Applications with Backbone.jsRefactoring Large Web Applications with Backbone.js
Refactoring Large Web Applications with Backbone.js
 
SPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuerySPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuery
 
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePointSPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
 
An Introduction to webOS
An Introduction to webOSAn Introduction to webOS
An Introduction to webOS
 
Cordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web SkillsCordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web Skills
 
HTML5 on Mobile
HTML5 on MobileHTML5 on Mobile
HTML5 on Mobile
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen Lju
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen Lju
 
jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobile
 
ADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
ADF Mobile: 10 Things you don't get from the developers guide - Luc BorsADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
ADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
 
ADF Mobile: 10 Things you don't get from the developers guide
ADF Mobile: 10 Things you don't get from the developers guideADF Mobile: 10 Things you don't get from the developers guide
ADF Mobile: 10 Things you don't get from the developers guide
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
Mini-Training: AngularJS
Mini-Training: AngularJSMini-Training: AngularJS
Mini-Training: AngularJS
 

Recently uploaded

Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 

Recently uploaded (20)

Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 

jQuery Mobile and JavaScript

  • 1. jQuery Mobile part 2 Gary 2014/1/8
  • 2. Outline • jQuery Mobile and JavaScript • Document Event • Configuration • Method and Utility • Theme • App Package
  • 3. Document Event • Unlike other jQuery projects, such as jQuery and jQuery UI, jQuery Mobile automatically applies many markup enhancements as soon as it loads • The sequence of document event • mobileinit • ready • load <script src="jquery.js"></script> <script> $(document).bind('mobileinit', function(){ $.mobile.ajaxEnabled=false; }); </script> <script src="jquery-mobile.js"></script>
  • 4. Configuration • Global • UI • AJAX • Regionalization • Touch overflow • Page • Page loading • Widget
  • 5. Configuration - UI • activeBtnClass string, default: "ui-btn-active" • The CSS class used for "active" button state. • activePageClass string, default: "ui-page-active" • The CSS class used for the page currently in view or in a transition. • minScrollBack integer, default: 250 • Minimum scroll distance that will be remembered when returning to a page. • defaultDialogTransition string, default: 'pop' • Set the default transition for dialog changes that use Ajax. Set to 'none' for no transitions.
  • 6. Configuration - AJAX • When jQuery Mobile attempts to load an external page, the request runs through $.mobile.loadPage(). This will only allow cross-domain requests if $.mobile.allowCrossDomainPages is set to true. • jQuery Mobile framework tracks what page is being viewed within the browser's location hash, it is possible for a cross-site scripting (XSS) attack to occur if the XSS code in question can manipulate the hash and set it to a cross-domain URL of its choice. This is the main reason that the default setting for $.mobile.allowCrossDomainPages is set to false.
  • 7. Configuration - Regionalization • Hard-coded //Global String $.mobile.loadingMessage = “loading”; $.mobile.pageLoadErrorMessage = “Error Loading Page” //Widget String $.mobile.page.prototype.options.backBtnText = “Back”; $.mobile.dialog.prototype.options.closeBtnText = “Close”; //Global String $.mobile.loadingMessage = “cargando”; $.mobile.pageLoadErrorMessage = “Error Cargando Página” //Widget String $.mobile.page.prototype.options.backBtnText = “Atrás”; $.mobile.dialog.prototype.options.closeBtnText = “Cerrar”; Deprecated $( document ).bind( 'mobileinit', function(){ $.mobile.loader.prototype.options.text = "loading"; $.mobile.loader.prototype.options.textVisible = false; $.mobile.loader.prototype.options.theme = "a"; $.mobile.loader.prototype.options.html = ""; });
  • 8. Configuration– Touch Overflow • A feature called touchOverflowEnabled is designed to leverage the upcoming wave of browsers that support overflow scrolling in CSS. Page Header Footer Content <head> <body> <script> $(document).bind("mobileinit", function(){ $.mobile.touchOverflowEnabled = true; }); </script> Deprecated Scrolling area
  • 9. Configuration - Page • Configuration of page • Configuration of loading page • Whenever loading external pages using AJAX, some default attributes are applied • Change loading page attributes once, not every time $(document).bind(‘mobileinit’, function(){ $.mobile.page.prototype.options.addbackbtn = true; $.mobile.page.prototype.options.backBtnTheme = “e”; $.mobile.page.prototype.options.headerTheme = “b”; $.mobile.page.prototype.options.footerTheme = “d”; }); $.mobile.loadPage.defaults $.mobile.changePage
  • 10. Configuration - Widgets • Every widget in jQuery Mobile has its own default configuration • We can modify the option objects of widget’s prototype • Every widget supports theme default attributes $(document).bind(‘mobileinit’, function(){ $.mobile.listview.prototype.filter = true; $.mobile.selectmenu.prototype.nativeMenu = false; });
  • 11. Method and Utility • Data-* • Page • Platform • Path • UI
  • 12. Method and Utility – Data-* • $.fn.jqmData(), $.fn.jqmRemoveData() • When working with jQuery Mobile, jqmData and jqmRemoveData should be used in place of jQuery core's data and removeData methods , as they automatically incorporate getting and setting of namespaced data attributes (even if no namespace is currently in use). • In jQuery • In jQuery Mobile $("div[data-role='page']") $("div:jqmData(role='page')") $("div[data-"+ $.mobile.ns +"role='page']")
  • 13. Method and Utility – Page • $.mobile.activePage() • Reference to the page currently in view. • $.mobile.changePage() • Programmatically change from one page to another. This method is used internally for the page loading and transitioning that occurs as a result of clicking a link or submitting a form, when those features are enabled. $.mobile.changePage(“external.html”); $mobile.changePage($(“#pageId”));
  • 14. Method and Utility – Page • The second non-essential argument $.mobile.changePage($(“#page2”), { transition: “slide”, reverse: true }); <script> function viewProduct(idProduct){ $.mobile.changePage(“productdetail.php”, { method: “post”, data: { action: ‘getproduct’, id: idProduct }, transition: “fade” }); } </script>
  • 15. Method and Utility – Platform • The framework provides some platform utilities to web development function clickbtn2(){ $gradeA2 = $.mobile.gradeA(); $getScreenHeight2 = $.mobile.getScreenHeight(); $getGradeA = $("#show").val("id"); $getGradeA.html($getScreenHeight2); if ($gradeA2){ alert("it's true"); } }
  • 16. Method and Utility – Platform • $.mobile.path.parseUrl() • Utility method for parsing a URL and its relative variants into an object that makes accessing the components of the URL easy. When parsing relative variants, the resulting object will contain empty string values for missing components (like protocol, host, etc). // 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);
  • 17. Method and Utility - UI • $.mobile.silentScroll() • Scroll to a particular Y position without triggering scroll event listeners. • $.mobile.showPageLoadingMsg() • Show the page loading message, which is configurable via $.mobile.loadingMessage • $.mobile.hidePageLoadingMsg() • Hide the page loading message, which is configurable via $.mobile.loadingMessage. $.mobile.showPageLoadingMsg(); setTimeout(function() { $.mobile.hidePageLoadingMsg(); }, 2000); $.mobile.loading('show'); setTimeout(function() { $.mobile.loading(‘hide'); }, 2000); Deprecated
  • 18. Theme • The theming system used in jQuery Mobile is similar to the ThemeRoller system in jQuery UI with a few important improvements: • CSS3 properties • rounded corners, box and text shadow and gradients • lightweight and reducing server requests. • Multiple color "swatches" — each consisting of • a header bar, content body, and button states • make richer designs possible. • Open-ended theming • 26 unique swatches per theme • CSS3 gradients • reduce file size and number of server requests. • Simplified icon set • reduce image weight.
  • 19. Theme • The easiest way to create custom themes is with the ThemeRoller tool. It allows you to build a theme, then download a custom CSS file, ready to be dropped into your project. • If no theme swatch letter is set at all, the framework uses the "a" swatch (black in the default theme) for headers and footers and the "c" swatch (light gray in the default theme) for the page content to maximize contrast between the both.
  • 21. Theme
  • 22. Theme
  • 23. Theme <link rel="stylesheet" href="css/themes/test.css" /> <link rel="stylesheet" href="css/themes/jquery.mobile.icons.min.css" /> … <div data-role="page" id="pagetwo" data-theme="c">
  • 24. App Package • Native app • Installed through an application store (such as Google Play or Apple’s App Store) • Developed specifically for one platform • Can take full advantage of all the device features • Web app • Not real apps • Websites that, in many ways, look and feel like native applications. • Run by a browser and typically written in HTML5 • Hybrid app • Part native apps, part web apps. • Live in an app store • Rely on HTML being rendered in a browser
  • 25. App Package – Native App • Pros • Be able to access all the features of the phone (GPS, camera, etc.) • Better run speed, performance and overall user experience • Support for offline work • Rich graphics and animation • Can be found easily at app store • The app icons are shown on the screen • Download an app need to pay • Cons • More limits (specific operating system) • Unknown deployment time (app store approval process) • Content Restrictions (app store restrictions) • User must update manually
  • 26. App Package – Web App • Pros • Wide range of devices (almost all smart phones) • Low development costs • Deploy quickly and easily • No content restrictions • Users always access to the latest version • Cons • Poorer performance and user experience • Poor graphics and animation support • Does not apply to the app store • Have to connect with Internet • Restrict some functions (GPS, camera, etc.)
  • 27. App Package – Hybrid App • Pros • Support multi-platform access • Phone functions are accessible • Suitable for applications store • Partial support offline • Cons • Unknown deployment time • User experience is not as good as using native apps • Not very mature technology
  • 28. App Package • Phonegap • a free and open source framework that allows you to create mobile apps using standardized web APIs for the platforms you care about. • appMobi • Cross platform push messaging, app promotion, in-app purchasing, integrated analytics and more, for all applications and deployed in any environment.
  • 29. App Package • Need adobe or github account
  • 31. App Package • Run on Android phone
  • 32. Conclusion • PhoneGap is an HTML5 app platform that allows developers to author native applications with web technologies and get access to APIs and app stores. • Applications are built as normal HTML pages and packaged up to run as a native application within a UIWebView or WebView (a chromeless browser).