活动介绍
file-type

jQuery Mobile 1.0.1版本文件全面解析

ZIP文件

下载需积分: 50 | 106KB | 更新于2025-04-03 | 177 浏览量 | 12 下载量 举报 收藏
download 立即下载
### 知识点一:jQuery Mobile框架概述 jQuery Mobile是基于jQuery库的框架,专门用于移动设备上的网页设计与开发。它支持多种移动平台,提供了丰富的UI组件和一套统一的交互模式,使得开发者能够轻松构建出响应式和触控友好的移动应用界面。框架遵循HTML5的规范,使用声明式编程风格,通过简单的HTML标记就能创建丰富的移动界面。 ### 知识点二:jQuery Mobile与传统jQuery的区别 传统的jQuery库专注于对DOM元素进行操作,主要用于增强网页的交互性能,而jQuery Mobile则针对移动设备的触摸操作和视图变化进行了优化。它不仅仅局限于对DOM的操作,还包括页面结构的组织、视图的转换以及响应式设计等。同时,jQuery Mobile还提供了许多移动特有的交互效果和组件,比如滑动切换、折叠列表、按钮组、表单控件等。 ### 知识点三:jQuery Mobile文件结构与内容 从文件名称列表可以看出,这里提供了两个版本的JavaScript文件(jquery.mobile-1.0.1.js和jquery.mobile-1.0.1.min.js)和两个版本的CSS文件(jquery.mobile-1.0.1.css和jquery.mobile-1.0.1.min.css)。 #### 1. JavaScript文件 - **jquery.mobile-1.0.1.js**:这是未压缩的完整版jQuery Mobile脚本文件。它包含了完整的源代码,适合用于开发和调试阶段,便于开发者阅读和理解代码逻辑。 - **jquery.mobile-1.0.1.min.js**:这是对完整版脚本文件进行压缩处理的版本。压缩后的文件体积更小,加载速度更快,适合生产环境使用。压缩操作通常会移除空格、换行符以及不必要的注释,有时还会将变量名缩短,从而减少文件大小。 #### 2. CSS文件 - **jquery.mobile-1.0.1.css**:这是未压缩的jQuery Mobile样式表文件。它包含了所有的CSS规则,用于定义框架中的主题和样式。开发者可以根据需要查看和修改这些样式以适应不同的设计需求。 - **jquery.mobile-1.0.1.min.css**:这是对未压缩样式表文件进行压缩处理的版本,它的目的是减少文件大小,优化加载时间。压缩过程包括移除空格、换行符和注释。 ### 知识点四:如何使用jQuery Mobile 要在项目中使用jQuery Mobile,开发者需要按照以下步骤操作: 1. 引入jQuery库:因为jQuery Mobile是基于jQuery的,因此需要先引入jQuery库。 ```html <script src="path/to/jquery.js"></script> ``` 2. 引入jQuery Mobile的CSS文件:这一步是必须的,因为它定义了框架的基本样式。 ```html <link rel="stylesheet" href="path/to/jquery.mobile-1.0.1.css" /> ``` 3. 引入jQuery Mobile的JavaScript文件:这一步将激活框架的JavaScript功能。 ```html <script src="path/to/jquery.mobile-1.0.1.js"></script> ``` 4. 使用HTML5的`data-*`属性:通过这些自定义属性可以快速设置各种UI组件和页面的配置。 5. 构建页面结构:使用`<div data-role="page">`创建页面,并用`<div data-role="header">`、`<div data-role="content">`和`<div data-role="footer">`来组织页面的不同部分。 ### 知识点五:版本号解释 标题中提到的"1.0.1"是jQuery Mobile的版本号。版本号通常遵循主版本号.次版本号.修订号的格式。在jQuery Mobile的情况下,这个版本号通常表示以下意义: - 主版本号(1):通常表示较大的更新,可能包含重大的新功能、重大更改或不兼容的旧版更改。 - 次版本号(0):代表次要功能更新和改进。 - 修订号(1):通常用于修复错误和小问题,以及小的改进,对用户影响较小。 每个新版本的发布,都伴随着更新日志,详细列出了所做改动,方便开发者了解哪些功能变化或修复可能会对现有项目产生影响。 综上所述,jQuery Mobile通过提供一套完整的移动界面解决方案,简化了移动应用的开发流程,减少了重复工作,并确保了应用的高性能和跨平台兼容性。通过理解和使用这些知识点,开发者可以更好地将jQuery Mobile融入到自己的项目中。

相关推荐

filetype
/* @license * jQuery.print, version 1.3.2 * (c) Sathvik Ponangi, Doers' Guild * Licence: CC-By (http://creativecommons.org/licenses/by/3.0/) *--------------------------------------------------------------------------*/ (function ($) { "use strict"; // A nice closure for our definitions function getjQueryObject(string) { // Make string a vaild jQuery thing var jqObj = $(""); try { jqObj = $(string) .clone(); } catch (e) { jqObj = $("") .html(string); } return jqObj; } function printFrame(frameWindow) { // Print the selected window/iframe var def = $.Deferred(); try { setTimeout(function () { // Fix for IE : Allow it to render the iframe frameWindow.focus(); try { // Fix for IE11 - printng the whole page instead of the iframe content if (!frameWindow.document.execCommand('print', false, null)) { // document.execCommand returns false if it failed -http://stackoverflow.com/a/21336448/937891 frameWindow.print(); } } catch (e) { frameWindow.print(); } frameWindow.close(); def.resolve(); }, 250); } catch (err) { def.reject(err); } return def; } function printContentInNewWindow(content) { // Open a new window and print selected content var w = window.open(); w.[removed](content); w.document.close(); return printFrame(w); } function isNode(o) { /* http://stackoverflow.com/a/384380/937891 */ return !!(typeof Node === "object" ? o instanceof Node : o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName === "string"); } $.print = $.fn.print = function () { // Print a given set of elements var options, $this, self = this; // console.log("Printing", this, arguments); if (self instanceof $) { // Get the node if it is a jQuery object self = self.get(0); } if (isNode(self)) { // If `this` is a HTML element, i.e. for // $(selector).print() $this = $(self); if (arguments.length > 0) { options = arguments[0]; } } else { if (arguments.length > 0) { // $.print(selector,options) $this = $(arguments[0]); if (isNode($this[0])) { if (arguments.length > 1) { options = arguments[1]; } } else { // $.print(options) options = arguments[0]; $this = $("html"); } } else { // $.print() $this = $("html"); } } // Default options var defaults = { globalStyles: true, mediaPrint: false, stylesheet: null, noPrintSelector: ".no-print", iframe: true, append: null, prepend: null, manuallyCopyFormValues: true, deferred: $.Deferred() }; // Merge with user-options options = $.extend({}, defaults, (options || {})); var $styles = $(""); if (options.globalStyles) { // Apply the stlyes from the current sheet to the printed page $styles = $("style, link, meta, title"); } else if (options.mediaPrint) { // Apply the media-print stylesheet $styles = $("link[media=print]"); } if (options.stylesheet) { // Add a custom stylesheet if given $styles = $.merge($styles, $('<link rel="stylesheet" href="' + options.stylesheet + '">')); } // Create a copy of the element to print var copy = $this.clone(); // Wrap it in a span to get the HTML markup string copy = $("") .append(copy); // Remove unwanted elements copy.find(options.noPrintSelector) .remove(); // Add in the styles copy.append($styles.clone()); // Appedned content copy.append(getjQueryObject(options.append)); // Prepended content copy.prepend(getjQueryObject(options.prepend)); if (options.manuallyCopyFormValues) { // Manually copy form values into the HTML for printing user-modified input fields // http://stackoverflow.com/a/26707753 copy.find("input") .each(function () { var $field = $(this); if ($field.is("[type='radio']") || $field.is("[type='checkbox']")) { if ($field.prop("checked")) { $field.attr("checked", "checked"); } } else { $field.attr("value", $field.val()); } }); copy.find("select").each(function () { var $field = $(this); $field.find(":selected").attr("selected", "selected"); }); copy.find("textarea").each(function () { // Fix for https://github.com/DoersGuild/jQuery.print/issues/18#issuecomment-96451589 var $field = $(this); $field.text($field.val()); }); } // Get the HTML markup string var content = copy.html(); // Notify with generated markup & cloned elements - useful for logging, etc try { options.deferred.notify('generated_markup', content, copy); } catch (err) { console.warn('Error notifying deferred', err); } // Destroy the copy copy.remove(); if (options.iframe) { // Use an iframe for printing try { var $iframe = $(options.iframe + ""); var iframeCount = $iframe.length; if (iframeCount === 0) { // Create a new iFrame if none is given $iframe = $('<iframe height="0" width="0" border="0" wmode="Opaque"/>') .prependTo('body') .css({ "position": "absolute", "top": -999, "left": -999 }); } var w, wdoc; w = $iframe.get(0); w = w.contentWindow || w.contentDocument || w; wdoc = w.document || w.contentDocument || w; wdoc.open(); wdoc.write(content); wdoc.close(); printFrame(w) .done(function () { // Success setTimeout(function () { // Wait for IE if (iframeCount === 0) { // Destroy the iframe if created here $iframe.remove(); } }, 100); }) .fail(function (err) { // Use the pop-up method if iframe fails for some reason console.error("Failed to print from iframe", err); printContentInNewWindow(content); }) .always(function () { try { options.deferred.resolve(); } catch (err) { console.warn('Error notifying deferred', err); } }); } catch (e) { // Use the pop-up method if iframe fails for some reason console.error("Failed to print from iframe", e.stack, e.message); printContentInNewWindow(content) .always(function () { try { options.deferred.resolve(); } catch (err) { console.warn('Error notifying deferred', err); } }); } } else { // Use a new window for printing printContentInNewWindow(content) .always(function () { try { options.deferred.resolve(); } catch (err) { console.warn('Error notifying deferred', err); } }); } return this; }; })(jQuery);
frank201113
  • 粉丝: 25
上传资源 快速赚钱