文献翻译JQuery标签的使用

上传人:206****923 文档编号:91102075 上传时间:2019-06-22 格式:DOC 页数:20 大小:282.50KB
返回 下载 相关 举报
文献翻译JQuery标签的使用_第1页
第1页 / 共20页
文献翻译JQuery标签的使用_第2页
第2页 / 共20页
文献翻译JQuery标签的使用_第3页
第3页 / 共20页
文献翻译JQuery标签的使用_第4页
第4页 / 共20页
文献翻译JQuery标签的使用_第5页
第5页 / 共20页
点击查看更多>>
资源描述

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

1、本科毕业设计外文文献及译文文献、资料题目: Jquery In ActionUsing the jQuery flags 文献、资料来源:著作文献、资料发表(出版)日期:2008.7.15院 (部): 专 业: 班 级:姓 名: 学 号: 指导教师: 翻译日期: 19外文文献: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

2、 plugin 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 a

3、re 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 an

4、imations 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

5、detect 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 in

6、tervening 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 ca

7、se, 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

8、 Detecting 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 ne

9、ed 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 st

10、rong, 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 make

11、s 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 proble

12、m.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 p

13、opular 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 consider

14、ing 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

15、vendors 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

16、 this 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

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

当前位置:首页 > 中学教育 > 其它中学文档

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