jQuery基础

 

目录

1.认识jQuery

 2.使用jQuery

2.1下载jQuery

 2.2安装jQuery

2.3测试jQuery


        jQuery是一个轻量级的JavaScript框架,是继Prototype之后出现的非常优秀的JavaScript核心库。jQuery的设计宗旨是“Writer Less,Do More”,即倡导写更少的代码,做更多的事情。

1.认识jQuery

        jQuery诞生于2005年,由John Resign开发。jQuery经历十多年的开发,如今该框架底层代码经过不断优化变得非常简洁、高效,成为全球最受欢迎的JavaScript代码框架。

        jQuery封装常用的JavaScript代码,提供一种简便的JavaScript设计模式,优化HTML文档操作、事件处理、CSS设计和Ajax交互。

        jQuery功能很强大,它能够帮助用户方便、快速地完成下面任务。

  1. 精确选择页面对象。
    jQuery提供了可靠而富有效率的选择器,只需要一个CSS选择器字符串,即可准确获取需要检查或操纵的文档元素。
  2. 进行可靠的CSS样式控制。
    使用JavaScript控制CSS受限于浏览器的兼容性,而jQuery可以弥补这一不足,他提供了跨浏览器的标准解决方案。
  3. 使用DOM操作规范化。
    jQuery使用少量的代码就能够完成复杂的DOM操作,对HTML文档的整个结构都能重写或者扩展。使用起来远比JavaScript直接控制便捷。
  4. 标准化事件控制。
    jQuery提供丰富的页面事件,这些事件使用简单、易用、易记,不需要考虑浏览器兼容性问题,但是如果使用JavaScript直接控制用户行为,需要考虑的问题就很多,既需要考虑HTML文档结构与事件处理函数的合成,还需要考虑浏览器的不一致性。
  5. 支持网页特效。
    jQuery内置了一批淡入、擦除和移动之类的效果,以及制作新效果的工具包,用户只需要简单地调用动画函数,就可以快速设计出高级动画页面。如果直接使用JavaScript实现,需要考虑CSS动画控制,还需要考虑浏览器解析差异,模拟的动画效果或许很生硬,或者很粗糙等。
  6. 快速通信。
    jQuery对Ajax技术的支持很缜密,它通过消除这一过程中的浏览器特定的复杂性,使用户得以专注于服务器端的功能设计。
  7. 扩展JavaScript内核。
    jQuery提供了对JavaScript核心功能的扩展,如迭代和数组操作等,增加对客户端、数据存储和JavaScript扩展的支持。

 2.使用jQuery

        jQuery项目主要包括jQuery Core(核心库)、jQuery UI(界面库)、Sizzle(CSS选择器)、jQuery Mobile(jQuery移动版)和QUnit(测试套件)5个部分。

jQuery参考网址
类型网址
jQuery框架官网https://jquery.com/
jQuery项目组官网http://jquery.org/
jQueryUI项目主页http://jqueryui.com/
jQueryMobile项目主页http://jquerymobile.com/
Sizzle选择器引擎官网http://sizzlejs.com/
QUnit官网http://qunitjs.com/
John Resign个人网站(jQuery原创作者)http://ejohn.org/

2.1下载jQuery

        访问jQuery官方网站(https://jquery.com/),下载最新新版的jQuery库文件,在网站首页单击“Download jQuery v.x”图标(x代表最新版本号),进入下载页面,如下图所示:

  

        如果选择“Download the compressed, production jQuery 3.6.1” 选项,则可以下载代码压缩版,下载的文件为jQuery-3.6.1.min.js。
         如果选择“Download the uncompressed, development jQuery 3.6.1” 选项,则可以下载包含注释的未被压缩的版本,下载的文件为jQuery-3.6.1.js。
        也可以访问下面网址进行下载:
        GitHub - jquery/jquery: jQuery JavaScript Library
        https://code.jquery.com/

 2.2安装jQuery

jQuery库不需要复杂的安装,只需要把下载的库文件放到站点中,然后导入页面即可。

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<!-- 引用jQuery.js -->
		<script src="./js/jquery-3.6.0.min.js"></script>
		<script type="text/javascript">
			// 在这里用户就可以使用jQuery编程了
		</script>
	</body>
</html>

2.3测试jQuery

        引入jQuery库文件之后,就可以在页面中进行jQuery开发了。

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<!-- 引用jQuery.js -->
		<script src="./js/jquery-3.6.0.min.js"></script>
		<script type="text/javascript">
			// 在这里用户就可以使用jQuery编程了
			// 调用JavaScript的alert()方法与浏览者打个招呼!!
			$(function(){
				alert("hi,你好!");
			})
		</script>
	</body>
</html>

 

  • 13
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
jQuery Widgets for PC, Mobile and Touch Devices jQuery Widgets for PC and Mobile What is jQWidgets? jQWidgets represents a framework based on jQuery for building web-based applications that run on PC, Touch and Mobile devices. jQWidgets includes more than 40 UI widgets. jQWidgets is not a modified version of the jQuery UI toolkit. All widgets are designed from ground-up and based on a powerful common core. The framework core provides fundamental capabilities like support for widget extensions and inheritance, widget settings, internal event handling and routing, property change notifications, device and browser compatibility detection and adjustments. Works across devices and browsers jQWidgets takes the JavaScript & HTML UI development to a new level. It is platform independent, cross-browser compatible and works on PC and mobile devices. Don抰 spend time testing on different devices and browsers. Use a reliable, CSS compliant JavaScript library based jQuery, HTML5 and CSS3.The product supports all major desktop and mobile web browsers - Internet Explorer 7.0+, Firefox 2.0+, Safari 3.0+, Opera 9.0+, Google Chrome, IE Mobile, Android, Opera Mini, Mobile Safari(IPhone, IPad). jQuery dependency and compatibility jQWidgets has a dependency on the jQuery library. jQWidgets is tested and compatible with all jQuery versions from jQuery 1.7.0 to jQuery 2.1.1. We are committed to supporting all new versions of jQuery and ensuring the highest level quality. At present, we highly recommend that you use jQuery 1.11.1. This version is stable, high quality, and works well with a large number of popular devices and browsers. It is ideal for enterprise web applications and Internet web sites where the visitors use a mix of mobile devices, PCs, new and older browsers. Important: jQuery team has decided that starting from jQuery version 1.9.0 the project will evolve in two parallel tracks. Versions 1.9.* will support older browsers while versions starting from 2.* will not. This means that if you are looking for the highest possible compatibility across the broadest set of devices and browsers, you should stick with versions earlier than 2.0.0 for some time. On the other hand, if you are using jQWidgets in a mobile application or building a solution where certain older browsers will not be required, feel free to use jQWidgets along with jQuery 2.0.0. It is important to emphasize that the pros and cons of maintaining compatibility with certain older browsers is always changing. If you want to make a good, well informed decision, we recommend you to check the recent browser usage statistics and analyze the browsers and devices used by your website抯 visitors. Optimized for Performance Small footprint, highly responsive, carefully optimized to deliver outstanding experience on a wide range of devices, operating systems and browsers. Theme Builder The Theme Builder is a powerful online tool that helps you to quickly create themes for the user interface of your application based on jQWidgets. Online Theme Builder Download and Installation Download jQWidgets Information about the distribution package The SDK files are located in the jqwidgets directory In general you need to use files from this directory only. Files list & description: Files required in all projects using the SDK jqxcore.js: Core jQWidgets framework Stylesheet files. Include at least one stylesheet Theme file and the images folder: styles/jqx.base.css: Stylesheet for the base Theme. The jqx.base.css file should be always included in your project. styles/jqx.arctic.css: Stylesheet for the Arctic Theme styles/jqx.web.css: Stylesheet for the Web Theme styles/jqx.bootstrap.css: Stylesheet for the Bootstrap Theme styles/jqx.classic.css: Stylesheet for the Classic Theme styles/jqx.darkblue.css: Stylesheet for the DarkBlue Theme styles/jqx.energyblue.css: Stylesheet for the EnergyBlue Theme styles/jqx.shinyblack.css: Stylesheet for the ShinyBlack Theme styles/jqx.office.css: Stylesheet for the Office Theme styles/jqx.metro.css: Stylesheet for the Metro Theme styles/jqx.metrodark.css: Stylesheet for the Metro Dark Theme styles/jqx.orange.css: Stylesheet for the Orange Theme styles/jqx.summer.css: Stylesheet for the Summer Theme styles/jqx.black.css: Stylesheet for the Black Theme styles/jqx.fresh.css: Stylesheet for the Fresh Theme styles/jqx.highcontrast.css: Stylesheet for the HighContrast Theme styles/jqx.blackberry.css: Stylesheet for the Blackberry Theme styles/jqx.android.css: Stylesheet for the Android Theme styles/jqx.mobile.css: Stylesheet for the Mobile Theme styles/jqx.windowsphone.css: Stylesheet for the Windows Phone Theme styles/jqx.ui-darkness.css: Stylesheet for the UI Darkness Theme styles/jqx.ui-lightness.css: Stylesheet for the UI Lightness Theme styles/jqx.ui-le-frog.css: Stylesheet for the UI Le Frog Theme styles/jqx.ui-overcast.css: Stylesheet for the UI Overcast Theme styles/jqx.ui-redmond.css: Stylesheet for the UI Redmond Theme styles/jqx.ui-smoothness.css: Stylesheet for the UI Smoothness Theme styles/jqx.ui-start.css: Stylesheet for the UI Start Theme styles/jqx.ui-sunny.css: Stylesheet for the UI Sunny Theme styles/images: contains images referenced in the stylesheet files Files for individual widgets. Include depending on project needs: jqx-all.js: All plug-ins and widgets jqxdata.js: Data Source plug-in jqxchart.js: Chart widget jqxgrid.js: Grid widget jqxgrid.sort.js: Grid Sort plug-in jqxgrid.filter.js: Grid Filter plug-in jqxgrid.grouping.js: Grid Grouping plug-in jqxgrid.selection.js: Grid Selection plug-in jqxgrid.columnsresize.js: Grid Columns Resize plug-in jqxgrid.columnsreorder.js: Grid Columns Reorder plug-in jqxgrid.pager.js: Grid Pager plug-in jqxgrid.edit.js: Grid Editing plug-in jqxgrid.storage.js: Grid Save/Load state plug-in jqxgrid.aggregates.js: Grid Aggregates plug-in jqxgauge.js: Radial and Linear Gauge widget jqxdatatable.js: DataTable widget jqxtreegrid.js: TreeGrid widget jqxrangeselector.js: RangeSelector widget jqxbuttons.js: Button, RepeatButton, SubmitButton & ToggleButton widgets jqxbulletchart.js: BulletChart widget jqxbuttongroup.js: Button group widget jqxswitchbutton.js: Switch Button widget jqxcalendar.js: Calendar widget jqxdatetimeinput.js: DateTimeInput widget jqxdockpanel.js: DockPanel widget jqxdropdownlist.js: DropDownList widget jqxcombobox.js: ComboBox widget jqxtabs.js: Tabs widget jqxtree.js: Tree widget jqxtreemap.js: TreeMap widget jqxcheckbox.js: CheckBox widget jqxradiobutton.js: RadioButton widget jqxexpander.js: Expander widget jqxlistbox.js: ListBox widget jqxmaskedinput.js: Masked TextBox widget jqxmenu.js: Menu widget jqxnavigationbar.js: NavigationBar widget jqxnotification.js: Notification widget jqxnumberinput.js: NumberInput TextBox widget jqxinput.js: TextBox widget jqxpanel.js: Panel widget jqxpopup.js: impements PopUp widget jqxprogressbar.js: ProgressBar widget jqxpasswordinput.js: Password input widget jqxscrollbar.js: ScrollBar widget jqxtooltip.js: ToolTip widget jqxrating.js: Rating widget jqxsplitter.js: Splitter widget jqxslider.js: Slider widget jqxwindow.js: Window widget jqxdocking.js: Docking widget jqxcolorpicker.js: Color Picker widget jqxdropdownbutton.js: DropDown Button widget jqxvalidator.js: Validation plug-in jqxdragdrop.js: DragDrop plug-in jqxknockout.js: Knockout integration plug-in jqxresponse.js: Response plug-in jqxangular.js: AngularJS integration plug-in

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

面相进程,面相对象

你的鼓励是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值