文献翻译JQuery标签的使用.doc

上传人:m**** 文档编号:544316914 上传时间:2023-09-08 格式:DOC 页数:20 大小:285.50KB
返回 下载 相关 举报
文献翻译JQuery标签的使用.doc_第1页
第1页 / 共20页
文献翻译JQuery标签的使用.doc_第2页
第2页 / 共20页
文献翻译JQuery标签的使用.doc_第3页
第3页 / 共20页
文献翻译JQuery标签的使用.doc_第4页
第4页 / 共20页
文献翻译JQuery标签的使用.doc_第5页
第5页 / 共20页
点击查看更多>>
资源描述

《文献翻译JQuery标签的使用.doc》由会员分享,可在线阅读,更多相关《文献翻译JQuery标签的使用.doc(20页珍藏版)》请在金锄头文库上搜索。

1、本科毕业设计外文文献及译文文献、资料题目: Jquery In ActionUsing the jQuery flags 文献、资料来源:著作文献、资料发表(出版)日期:2008.7.15院 (部): 专 业: 班 级:姓 名: 学 号: 指导教师: 翻译日期: 外文文献:DOM with jQuery utility functions Using the jQuery flags6.1 Using the jQuery flags Some of the information jQuery makes available to us as page authors, and even p

2、lugin authors, is available not via methods or functions but as properties defined on $. Many of these flags are focused on helping us divine the capabilities of the current browser, but others help us control the behavior of jQuery at a page-global level.The jQuery flags intended for public use are

3、 as follows: $.fx.offEnables or disabled effects $.supportDetails supported features $.browserExposes browser details (officially deprecated) Lets start by looking at how jQuery lets us disable animations. 6.1.1 Disabling animations There may be times when we might want to conditionally disable anim

4、ations in a page that includes various animated effects. We might do so because weve detected that the platform or device is unlikely to deal with them well, or perhaps for accessibility reasons.In any case, we dont need to resort to writing two pages, one with and one without animations. When we de

5、tect were in an animation-adverse environment, we can simply set the value of $.fx.off to true. This will not suppress any effects weve used on the page; it will simply disable the animation of those effects. For example, the fade effects will show and hide the elements immediately, without the inte

6、rvening animations.Similarly, calls to the animate() method will set the CSS properties to the specified final values without animating them. Using the jQuery flagsOne possible use-case for this flag might be for certain mobile devices or browsers that dont correctly support animations. In that case

7、, you might want to turn off animations so that the core functionality still works.The $.fx.off flag is a read/write flag. The remaining predefined flags are meant to be read-only. Lets take a look at the flag that gives us information on the environment provided by the user agent (browser). 6.1.2 D

8、etecting user agent support Thankfully, almost blissfully, the jQuery methods that weve examined so far shield us from having to deal with browser differences, even in traditionally problematic areas like event handling. But when were the ones writing these methods (or other extensions), we may need

9、 to account for the differences in the ways browsers operate so that the users of our extensions dont have to.Before we dive into seeing how jQuery helps us in this regard, lets talk about the whole concept of browser detection. WHY BROWSER DETECTION IS HEINOUS OK, maybe the word heinous is too stro

10、ng, but unless its absolutely necessary, the browser detection technique should be avoided.Browser detection might seem, at first, like a logical way to deal with browser differences. After all, its easy to say, “I know what the set of capabilities of browser X are, so testing for the browser makes

11、perfect sense, right?” But browser detection is full of pitfalls and problems.One of the major arguments against this technique is that the proliferation of browsers, as well as varying levels of support within versions of the same browser, makes this technique an unscalable approach to the problem.

12、You could be thinking, “Well, all I need to test for is Internet Explorer and Fire-fox.” But why would you exclude the growing number of Safari users? What about Opera and Googles Chrome? Moreover, there are some niche, but not insignificant, browsers that share capability profiles with the more pop

13、ular browsers. Camino, for example, uses the same technology as Firefox behind its Mac-friendly UI. And OmniWeb uses the same rendering engine as Safari and Chrome.Theres no need to exclude support for these browsers, but it is a royal pain to have to test for them. And thats without even considerin

14、g differences between versionsIE 6, IE 7, and IE 8, for example. Yet another reason is that if we test for a specific browser, and a future release fixes that bug, our code may actually stop working. jQuerys alternative approach to this issue (which well discuss in the next section) gives browser ve

15、ndors an incentive to fix the bugs that jQuery has worked around.A final argument against browser detection (or sniffing, as its sometimes called) is that its getting harder and harder to know whos who.Browsers identify themselves by setting a request header known as the user agent string. Parsing t

16、his string isnt for the faint-hearted. In addition, many browsers now allow their users to spoof this string, so we cant even believe what it tells us after we do go though all the trouble of parsing it! A JavaScript object named navigator gives us a partial glimpse into the user agent information, but even it has browser differences. We a

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 商业/管理/HR > 其它文档 > 租房合同

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号