您的位置:首页 > Web前端 > JQuery

jquery mobile_jQuery Mobile课程1

2020-08-06 14:03 1161 查看

jquery mobile

In a new series of articles, we will talk about jQuery Mobile framework, which easily allows you to create responsive mobile websites.

在一系列新文章中,我们将讨论jQuery Mobile框架,该框架可轻松使您创建响应式移动网站。

jQuery MOBILE入门 (GETTING STARTED WITH jQuery MOBILE)

WHAT IS JQUERY MOBILE jQuery Mobile is a reliable support for all the abundance of mobile development kits and tools that makes a mobile site responsive, flexible and simple. jQuery Mobile is fundamentally be defined as a set of jQuery plug-ins and widgets that aim to provide a cross platform API for creating mobile web applications. In terms of code implementation, jQuery Mobile is very similar to jQuery UI, but while jQuery UI is focused on desktop applications, jQuery Mobile is built with mobile devices in mind.

什么是JQUERY移动 jQuery Mobile是对所有丰富的移动开发工具包和工具的可靠支持,这些移动开发工具包和工具使移动站点能够响应,灵活和简单。 从根本上将jQuery Mobile定义为一组jQuery插件和小部件,旨在提供用于创建移动Web应用程序的跨平台API。 在代码实现方面,jQuery Mobile与jQuery UI非常相似,但是jQuery UI专注于桌面应用程序,而jQuery Mobile是在考虑移动设备的基础上构建的。

‘A MUST KNOW’ ABOUT CREATING A MOBILE WEB While developing a mobile web bear these three key words in mind, which that a mobile web MUST be

关于创建移动Web的“必须知道”在开发移动Web时,请牢记以下三个关键词,即移动Web必须

  1. Responsive

    React灵敏
  2. Flexible

    灵活
  3. Simple

    简单
  • Responsiveness entails how a page looks when it transits; a button is tapped and how content loads on mobile.

    响应性要求页面在过渡时的外观; 点击一个按钮,以及如何在移动设备上加载内容。

  • Flexibility entails that mobile web should be free customizable by the user to suits his/her desire

    灵活性要求移动网络应由用户免费自定义以适合他/她的需求

  • Simplicity means that a mobile should be site an easy navigating site.

    简单意味着移动设备应该是易于导航的站点。

A MUST KNOW ABOUT jQuery MOBILE FOR DEVELOPERS

开发人员必须知道的jQuery Mobile

jQuery have made a great impact in the emerging world of fascinating web development and designing, changed the way developers implement and use JavaScript on websites and web applications that Microsoft has chosen it as a preferred javascript framework, and Microsoft has included full auto-completion support for jQuery inside visual studio therefore JQuery mobile an extract /extension of/in the amazing jQuery library is supportive and reliable.

jQuery在令人着迷的Web开发和设计的新兴世界中产生了巨大影响,改变了开发人员在网站和Web应用程序上实现和使用JavaScript的方式,Microsoft选择了它作为首选的javascript框架,并且Microsoft包括了完整的自动完成支持对于Visual Studio中的jQuery,因此JQuery mobile令人惊叹的jQuery库中的/ extension扩展/支持是可靠的。

WHY JQUERY MOBILE {NEED TO KNOW jQuery MOBILE AS A DEVELOPER} As I have illustrated in ‘a must know about jQuery mobile for developers‘; As mobile device generation emerges so as the need for mobile responsive, flexible and simple web application grows therefore the need and demand for jQuery mobile (jQuery frame work) rapidly increases, and now is a great time for you guru or beginner in mobile web API to jump in and get involved with the project.

为什么使用JQUERY MOBILE {需要将jQuery MOBILE作为开发者}正如我在“ 对开发人员jQuery移动必知 ”中所说明的那样; 随着移动设备的出现,以及对移动响应,灵活和简单的Web应用程序的需求的增长,因此对jQuery mobile(jQuery框架)的需求和需求Swift增加,现在对于移动Web API专家或初学者来说是一个好时机参与该项目。

DEVICE THAT CAN RUN jQUERY MOBILE Running of jQuery on different device depends on the browser and operating system. Browsers that support jQuery mobile are those modern browsers that have support for HTML5 tags and some CSS 3 supports. The devices that support jQuery mobile are desktop, laptop, all-in-one systems, tablets, Smartphones, Android, ios, Blackberry (high version), webOS, Windows mobile and eReader Devices. jQuery mobile supports kindle devices that include the experimental webkit-based browser.

可以运行jQUERY MOBILE的设备在不同设备上运行jQuery取决于浏览器和操作系统。 支持jQuery mobile的浏览器是那些支持HTML5标签和一些CSS 3支持的现代浏览器。 支持jQuery mobile的设备包括台式机,笔记本电脑,多合一系统,平板电脑,智能手机,Android,ios,Blackberry(高版本),webOS,Windows mobile和eReader设备。 jQuery mobile支持包括基于实验性Webkit的浏览器的Kindle设备。

WHAT AN ADVANCE OR AN AMATURE DEVELOPER NEEDS FOR CREATING MOBILE SITE USING jQuery MOBILE 1. Development applications to use Development application for windows include Komodo IDE, eclipse, iWeb, Microsoft FrontPage, Aptana studio, Dreamweaver, notepad++. We are using Dreamweaver in this tutorial Development applications for OsX include Coda, espresso, textwrangler, kod 2. The language the mobile web developer should or should have known are HTML5, CSS 3 and Javascript.

使用jQuery MOBILE创建移动站点的高级或高级开发者需求 1.开发应用程序以使用Windows开发应用程序包括Komodo IDE,eclipse,iWeb,Microsoft FrontPage,Aptana studio,Dreamweaver,notepad ++。 在本教程中,我们将使用Dreamweaver。OsX的开发应用程序包括Coda,espresso,textwrangler,kod2。移动Web开发人员应该或应该知道的语言是HTML5,CSS 3和Javascript。

jQuery Mobile consists of four files: a JavaScript file, a CSS file, and two PNG graphic sprites. The JavaScript file is meant to be loaded after the base jQuery library. This script file performs various tasks, like creating widgets, applying event listeners, and enabling the API. A Cascading Style Sheet (CSS) which specifies layout and appearance of jQuery Mobile page elements. The Style Sheet also specifies transitions and animations with CSS3 transforms.

jQuery Mobile由四个文件组成:一个JavaScript文件,一个CSS文件和两个PNG图形精灵。 JavaScript文件应在基本jQuery库之后加载。 该脚本文件执行各种任务,例如创建窗口小部件,应用事件侦听器以及启用API。 一个级联样式表 ( CSS ),用于指定jQuery Mobile页面元素的布局和外观。 样式表还指定了CSS3转换的过渡和动画。

You can download the entire jQuery Mobile package (the JavaScript library, the CSS, and the graphics) or you can access them through the project’s CDN. See the jQuery Mobile project download page for specifics. In our examples for this tutorial, we will be using the CDN.

您可以下载整个jQuery Mobile程序包(JavaScript库,CSS和图形),也可以通过项目的CDN访问它们。 有关详细信息,请参见jQuery Mobile项目下载页面 。 在本教程的示例中,我们将使用CDN。

用于移动网站构建HTML内容的DOCTYPE (THE DOCTYPE FOR BUILDING HTML CONTENT FOR MOBILE SITE)

HTML4 TRANSITIONAL DOCTYPE Developers who are still satisfied using deprecated HTML tags but want to move on to HTML 4 can use the transitional DOCTYPE which allows the browser to parse through deprecated tags and displays without throwing any errors.

HTML4过渡性DOCTYPE使用过时HTML标记仍感到满意,但希望继续使用HTML 4的开发人员可以使用过渡性DOCTYPE,这使浏览器可以解析过时的标记和显示内容而不会引发任何错误。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
[/code]

Fig 1.1 section 1.1 – html 4 transitional doctype

图1.1第1.1节– html 4过渡文档类型

HTML4 STRICT DOCTYPE Developers who do not want to include support for deprecated tags and the possible formatting errors that may ensue when using a ‘compatibility’ mode can use the strict DOCTYPE which tells the browser to throw errors when deprecated tags are included in the HTML file it is trying to load. This can be useful as it guarantees your work is at least up to the HTML 4 standard.

HTML4 STRICT DOCTYPE如果开发人员不想包括对不赞成使用的标记的支持以及使用“兼容”模式时可能发生的格式错误,可以使用严格的DOCTYPE,它可以告诉浏览器在HTML文件中包含不赞成使用的标记时引发错误。它正在尝试加载。 这很有用,因为它可以确保您的工作至少符合HTML 4标准。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/scrict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/scrict.dtd">
[/code]

Fig 1.2 section 1.1 – html 4 strcit doctype

图1.2第1.1节– html 4 strcit doctype

HTML5 DOCTYPE Using the HTML5 DOCTYPE works on almost all legacy browsers and is already in use on many websites today. To use the HTML5 DOCTYPE in your HTML file, use the following snippet:

HTML5 DOCTYPE使用HTML5 DOCTYPE几乎可以在所有旧版浏览器上使用,并且如今已在许多网站上使用。 要在HTML文件中使用HTML5 DOCTYPE,请使用以下代码段:

<!DOCTYPE html>
<!DOCTYPE html>
[/code]

Fig 1.3 section 1.1 – html 5 doctype

图1.3第1.1节– html 5 doctype

BASIC SITE STRUCTURE USING HTML5 DOCTYPE

使用HTML5 DOCTYPE的基本网站结构

<!DOCTYPE html><html>
<head><title></title></head>
<body></body>
</html>
<!DOCTYPE html><html>
<head><title></title></head>
<body></body>
</html>
[/code]

Fig 1.4 section 1.1 – basic site structure using html 5 doctype

图1.4第1.1节–使用html 5 doctype的基本站点结构

使用HTML5结构,CSS和JAVASCRIPT (WORKING WITH HTML5 STRUCTURE, CSS AND JAVASCRIPT)

BUILDING AND PRESENTING CONTENT IN HTML5

在HTML5中构建和呈现内容

<!DOCTYPE html><html>
<head>
<title>Titles should be short descriptions of the page</title>
<meta charset="utf-8">
</head>
<body>
<div>
<h1>h1 tags should contain the most important information on your site</h1>
<p>Paragraph tags should be where most of your text content lives, or used as a separation between sections.</p>
<ul>
<li>This is a list element</li>
<li>This is another element, notice the bullets and indentation </li>
</ul>
<p>You probably noticed that I used a "div" tag to wrap these other tags in. I'm using it as a container.</p>
</div>
</body>
</html>
<!DOCTYPE html><html>
<head>
<title>Titles should be short descriptions of the page</title>
<meta charset="utf-8">
</head>
<body>
<div>
<h1>h1 tags should contain the most important information on your site</h1>
<p>Paragraph tags should be where most of your text content lives, or used as a separation between sections.</p>
<ul>
<li>This is a list element</li>
<li>This is another element, notice the bullets and indentation </li>
</ul>
<p>You probably noticed that I used a "div" tag to wrap these other tags in. I'm using it as a container.</p>
</div>
</body>
</html>
[/code]

Fig 1.5 section 1.2 – building and presenting content in html 5

图1.5第1.2节–在html 5中构建和显示内容

We know what the code does, but let’s take a look at what it actually looks like. The image below shows what the rendered HTML looks like.

Fig 1.6 section 1.2 – browser preview of building and presenting content in html 5

我们知道代码的作用,但让我们看一下它的实际外观。 下图显示了呈现HTML外观。

图1.6第1.2节–在html 5中构建和显示内容的浏览器预览

CSS IN BUILDING AND PRESENTING CONTENT IN HTML5 Just after the <title> </title> tags press enter and insert snippet as shown in the preceding image link a stylesheet file .css to the main .html file

Fig 1.7 section 1.2 – linking css to Html 5 in building and presenting web content

在HTML5中构建和呈现内容CSS在 <title> </ title>标签之后,按回车键并插入片段,如上图所示,将样式表文件.css链接到主.html文件

图1.7第1.2节–在构建和展示Web内容时将CSS链接到HTML 5

The below following script are found in the css file [hist.css]

在css文件[hist.css]中找到以下脚本

@charset "utf-8";
/* CSS Document */
body {
background:#0CF;
font-family: Helvetica, Arial, sans-serif;
font-size: 0.75em;
}
h1 {
font-size: 200%
}
p {
margin: 5px 0;
padding: 0 3px;
}
#year{
text-align:center;
font-weight:bold;
font-size:200%;
}
.small {
font-size: 80%;
}
@charset "utf-8";
/* CSS Document */
body {
background:#0CF;
font-family: Helvetica, Arial, sans-serif;
font-size: 0.75em;
}
h1 {
font-size: 200%
}
p {
margin: 5px 0;
padding: 0 3px;
}
#year{
text-align:center;
font-weight:bold;
font-size:200%;
}
.small {
font-size: 80%;
}
[/code]

Fig 1.8 section 1.2 – linking css to Html 5 in building and presenting web content

图1.8第1.2节–在构建和展示Web内容时将CSS链接到HTML 5

The image below shows what the rendered HTML will now look like after linking the .CSS file.

Fig 1.9 section 1.2 – rendered HTML browser preview after linking the .CSS file.

下图显示了链接.CSS文件后呈现HTML现在的外观。

图1.9第1.2节–链接.CSS文件后呈现HTML浏览器预览。

JAVASCRIPT IN BUILDING AND PRESENTING CONTENT IN HTML5 A summary of placing JavaScript tags in your document: Loading scripts in the head element makes them load first but can adversely affect the perceived load time. Loading scripts inside the body may seem like a good idea but creates issues with maintenance and throws possible loading delays. Loading scripts just before the closing body tag makes your site appear to load quickly but may have an unintended consequence of missing site functionality for up to the first few seconds.

在HTML5中构建和呈现内容的JAVASCRIPT在文档中放置JavaScript标记的摘要: 在head元素中加载脚本会使脚本首先加载,但会对感知的加载时间产生不利影响。 在体内加载脚本似乎是一个好主意,但会导致维护问题,并可能导致加载延迟。 在结束body标记之前加载脚本会使您的网站看起来快速加载,但是可能会在最初的几秒钟内意外丢失网站功能。

Let’s practice using LOADING SCRIPTS IN THE HEAD which is the most preferable for every developer

让我们练习在头中使用LOADING SCRIPTS,这对每个开发人员来说都是最可取的

<script src="js/javascript.js" type="text/javascript"></script>
</head>
<script src="js/javascript.js" type="text/javascript"></script>
</head>
[/code]

Fig 1.10 section 1.2 – loading javascript scripts in the head of html5

图1.10第1.2节–在html5的头部加载javascript脚本

The below following script are found in the .js file [javascript.js]

在.js文件[javascript.js]中找到以下脚本

// JavaScript Document
window.onload = setYear;
function setYear() {
var currentYear = new Date();
document.getElementById('year').innerHTML = currentYear.getFullYear();
}
// JavaScript Document
window.onload = setYear;
function setYear() {
var currentYear = new Date();
document.getElementById('year').innerHTML = currentYear.getFullYear();
}
[/code]

Fig 1.11 section 1.2 – loading javascript scripts in the head of html5

图1.11第1.2节–在html5的头部加载javascript脚本

The image below shows what the rendered HTML will now look like after linking the .js file.

Fig 1.12 section 1.2 – rendered html look after loading .js scripts files in the head of html5

下图显示了链接.js文件后呈现HTML现在的外观。

图1.12第1.2节–在html5的头部加载.js脚本文件后呈现的html外观

We just learned a little about current use of structuring HTML, linking CSS and loading Script (javascript) now lets get to know how to use our current learned skill in jQuery mobile

我们刚刚了解了有关结构化HTML,链接CSS和加载脚本(javascript)的当前用法,现在让我们了解了如何在jQuery mobile中使用我们现有的技能。

翻译自: https://www.script-tutorials.com/jquery-mobile-lesson-1/

jquery mobile

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: