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).
Ad

Recommended

jQuery Mobile: Progressive Enhancement with HTML5
jQuery Mobile: Progressive Enhancement with HTML5
Todd Anderson
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
Rakesh Jha
 
jQuery Mobile with HTML5
jQuery Mobile with HTML5
madhurpgarg
 
Quick Intro to JQuery and JQuery Mobile
Quick Intro to JQuery and JQuery Mobile
Jussi Pohjolainen
 
amis-adf-enterprise-mobility
amis-adf-enterprise-mobility
Luc Bors
 
Android UI Development
Android UI Development
Jussi Pohjolainen
 
Hastening React SSR - Web Performance San Diego
Hastening React SSR - Web Performance San Diego
Maxime Najim
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Get...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Get...
Uniface
 
Introduction to jquery mobile with Phonegap
Introduction to jquery mobile with Phonegap
Rakesh Jha
 
Thinking in Components
Thinking in Components
FITC
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
crokitta
 
Responsive Web Site Design
Responsive Web Site Design
Jussi Pohjolainen
 
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 uPortal
Jennifer Bourey
 
Modular 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...
DrupalCampDN
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuide
Mark Rackley
 
uMobile Preconference Seminar
uMobile Preconference Seminar
Jennifer Bourey
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flex
danielwanja
 
OttawaJS: angular accessibility
OttawaJS: angular accessibility
Derek Featherstone
 
Javascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web Apps
dnelson-cs
 
AngularJS
AngularJS
Srivatsan Krishnamachari
 
Once Source to Rule Them All
Once Source to Rule Them All
David Yeiser
 
jQuery Mobile UI
jQuery Mobile UI
LearningTech
 
Web Components v1
Web Components v1
Mike Wilcox
 
Anex.......
Anex.......
Carlos Catanejo
 
Native 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...
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 
JQuery mobile
JQuery mobile
Gary Yeh
 
Git Workflow
Git Workflow
Gary Yeh
 

More Related Content

What's hot (20)

Introduction to jquery mobile with Phonegap
Introduction to jquery mobile with Phonegap
Rakesh Jha
 
Thinking in Components
Thinking in Components
FITC
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
crokitta
 
Responsive Web Site Design
Responsive Web Site Design
Jussi Pohjolainen
 
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 uPortal
Jennifer Bourey
 
Modular 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...
DrupalCampDN
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuide
Mark Rackley
 
uMobile Preconference Seminar
uMobile Preconference Seminar
Jennifer Bourey
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flex
danielwanja
 
OttawaJS: angular accessibility
OttawaJS: angular accessibility
Derek Featherstone
 
Javascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web Apps
dnelson-cs
 
AngularJS
AngularJS
Srivatsan Krishnamachari
 
Once Source to Rule Them All
Once Source to Rule Them All
David Yeiser
 
jQuery Mobile UI
jQuery Mobile UI
LearningTech
 
Web Components v1
Web Components v1
Mike Wilcox
 
Anex.......
Anex.......
Carlos Catanejo
 
Native 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...
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 
Introduction to jquery mobile with Phonegap
Introduction to jquery mobile with Phonegap
Rakesh Jha
 
Thinking in Components
Thinking in Components
FITC
 
Oracle 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
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortal
Jennifer Bourey
 
Modular 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...
DrupalCampDN
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuide
Mark Rackley
 
uMobile Preconference Seminar
uMobile Preconference Seminar
Jennifer Bourey
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flex
danielwanja
 
OttawaJS: angular accessibility
OttawaJS: angular accessibility
Derek Featherstone
 
Javascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web Apps
dnelson-cs
 
Once Source to Rule Them All
Once Source to Rule Them All
David Yeiser
 
Web Components v1
Web Components v1
Mike Wilcox
 
Native look and feel bbui & alicejs
Native look and feel bbui & alicejs
.toster
 

Viewers also liked (11)

JQuery mobile
JQuery mobile
Gary Yeh
 
Git Workflow
Git Workflow
Gary Yeh
 
Linux Char Device Driver
Linux Char Device Driver
Gary Yeh
 
Servlet and JSP
Servlet and JSP
Gary Yeh
 
Database and Java Database Connectivity
Database and Java Database Connectivity
Gary Yeh
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
Gary Yeh
 
JQuery UI
JQuery UI
Gary Yeh
 
Introduction of openGL
Introduction of openGL
Gary Yeh
 
Run-time of Node.js : V8 JavaScript Engine
Run-time of Node.js : V8 JavaScript Engine
Gary Yeh
 
Implementing a JavaScript Engine
Implementing a JavaScript Engine
Kris Mok
 
Html5 canvas
Html5 canvas
Gary Yeh
 
JQuery mobile
JQuery mobile
Gary Yeh
 
Git Workflow
Git Workflow
Gary Yeh
 
Linux Char Device Driver
Linux Char Device Driver
Gary Yeh
 
Servlet and JSP
Servlet and JSP
Gary Yeh
 
Database and Java Database Connectivity
Database and Java Database Connectivity
Gary Yeh
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
Gary Yeh
 
Introduction of openGL
Introduction of openGL
Gary Yeh
 
Run-time of Node.js : V8 JavaScript Engine
Run-time of Node.js : V8 JavaScript Engine
Gary Yeh
 
Implementing a JavaScript Engine
Implementing a JavaScript Engine
Kris Mok
 
Html5 canvas
Html5 canvas
Gary Yeh
 
Ad

Similar to jQuery Mobile and JavaScript (20)

jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
Philipp Bosch
 
Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app
Ivano Malavolta
 
Jquery mobile
Jquery mobile
Predhin Sapru
 
Pablo Villalba -
Pablo Villalba -
.toster
 
Mobile App Development
Mobile App Development
Chris Morrell
 
Jquery mobile book review
Jquery mobile book review
Islam AlZatary
 
Mat Marquis - JQuery Mobile
Mat Marquis - JQuery Mobile
Harvard Web Working Group
 
Adobe & HTML5
Adobe & HTML5
Terry Ryan
 
J query mobile tech talk
J query mobile tech talk
woliverj
 
HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1
James Pearce
 
Web Application Development in 2023.pdf
Web Application Development in 2023.pdf
Techugo
 
Web Application Development- Best Practices in 2023.
Web Application Development- Best Practices in 2023.
Techugo
 
Mobile web development
Mobile web development
Moumie Soulemane
 
jQuery Mobile
jQuery Mobile
mowd8574
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devices
Wesley Hales
 
Mobile JS Frameworks
Mobile JS Frameworks
Ibrahim Ersoy
 
Introduction to jQuery Mobile
Introduction to jQuery Mobile
ejlp12
 
Real World Lessons in jQuery Mobile
Real World Lessons in jQuery Mobile
Kai Koenig
 
Intro to Jquery Mobile
Intro to Jquery Mobile
James Quick
 
Mobile web apps
Mobile web apps
Patrick Crowley
 
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
Philipp Bosch
 
Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app
Ivano Malavolta
 
Pablo Villalba -
Pablo Villalba -
.toster
 
Mobile App Development
Mobile App Development
Chris Morrell
 
Jquery mobile book review
Jquery mobile book review
Islam AlZatary
 
J query mobile tech talk
J query mobile tech talk
woliverj
 
HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1
James Pearce
 
Web Application Development in 2023.pdf
Web Application Development in 2023.pdf
Techugo
 
Web Application Development- Best Practices in 2023.
Web Application Development- Best Practices in 2023.
Techugo
 
jQuery Mobile
jQuery Mobile
mowd8574
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devices
Wesley Hales
 
Mobile JS Frameworks
Mobile JS Frameworks
Ibrahim Ersoy
 
Introduction to jQuery Mobile
Introduction to jQuery Mobile
ejlp12
 
Real World Lessons in jQuery Mobile
Real World Lessons in jQuery Mobile
Kai Koenig
 
Intro to Jquery Mobile
Intro to Jquery Mobile
James Quick
 
Ad

Recently uploaded (20)

Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
 
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Zoneranker’s Digital marketing solutions
Zoneranker’s Digital marketing solutions
reenashriee
 
Artificial Intelligence Workloads and Data Center Management
Artificial Intelligence Workloads and Data Center Management
SandeepKS52
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Technologies
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
NVIDIA Artificial Intelligence Ecosystem and Workflows
NVIDIA Artificial Intelligence Ecosystem and Workflows
SandeepKS52
 
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
 
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Zoneranker’s Digital marketing solutions
Zoneranker’s Digital marketing solutions
reenashriee
 
Artificial Intelligence Workloads and Data Center Management
Artificial Intelligence Workloads and Data Center Management
SandeepKS52
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
How to Choose the Right Web Development Agency.pdf
How to Choose the Right Web Development Agency.pdf
Creative Fosters
 
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Technologies
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
NVIDIA Artificial Intelligence Ecosystem and Workflows
NVIDIA Artificial Intelligence Ecosystem and Workflows
SandeepKS52
 
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 

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:[email protected]:8080/mail/inbox?msg=1234&type=unread#msg-content // obj.hrefNoHash: http://jblas:[email protected]:8080/mail/inbox?msg=1234&type=unread // obj.hrefNoSearch: http://jblas:[email protected]:8080/mail/inbox // obj.domain: http://jblas:[email protected]:8080 // obj.protocol: http: // obj.authority: jblas:[email protected]: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:[email protected]: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).