自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

使用jQTouch幾個常見問題的解決辦法

移動開發(fā) iOS
最近在開發(fā)iPhone版的網(wǎng)站,接觸到了一個jQuery插件,叫jQTouch。 這個插件是專門針對iPhone做jQuery效果的。但是在使用中遇到了許多問題,大部分是和之前的Javascript寫法的沖突,列在下面以供參考。

  最近在開發(fā)iPhone版的網(wǎng)站,接觸到了一個jQuery插件,叫jQTouch。 這個插件是專門針對iPhone做jQuery效果的。但是在使用中遇到了許多問題,大部分是和之前的Javascript寫法的沖突,列在下面以供參考。

  1、頁面跳轉(zhuǎn) jQTouch需要用target="_webapp"來做頁面跳轉(zhuǎn),不然會出問題噢。

  2、tap和click 網(wǎng)上搜到有人在問: I noticed an interesting bug with the JQTouch platform and wanted to know if anyone else has run into it our has a workaround for it. If I have a link with an onclick event and lightly tap the link on the iPhone, the link works, but the click event is not fired. If I tap the same link harder, the event fires. Any thoughts on this? 解決方法是使用tap來代替click。iOS系列會在輕觸鏈接時產(chǎn)生tap事件,重觸產(chǎn)生tap和click事件。 當然你可以使用這樣的語句來判斷系統(tǒng)

  var userAgent = navigator.userAgent.toLowerCase(); var isiPhone = (userAgent.indexOf('iphone') != -1) ? true : false; if(userAgent.indexOf('ipod') != -1) isiPhone = false; // turn off taps for iPod Touches clickEvent = isiPhone ? 'tap' : 'click'; $('#somelink').bind(clickEvent, function(){...});

  3、與Ajax的不兼容 jQTouch將頂層的多個div分成多個頁面顯示,是靠div的id來進行跳轉(zhuǎn)的。 如果你用Ajax來把整個div刷新,那么在back的時候就找不到原來的div id了,一方面使用back會出錯,另一方面在跳轉(zhuǎn)div的時候Ajax新拿到的頁面不會被去掉class="current"標記,導(dǎo)致幾個頁面重疊顯示。如果跳到的頁面比較長那還好,否則就杯具了…… 暫時遇到這幾個,有遇到再補充!

  來源:http://kylinhuang.blog.163.com/blog/static/18259419620101166344177/

責(zé)任編輯:佚名 來源: 網(wǎng)易博客
相關(guān)推薦

2010-08-17 11:35:46

DIV CSS

2012-06-06 12:48:28

Win8 RP版微軟

2010-09-07 09:50:35

DIVCSS

2011-04-27 16:04:12

投影機

2011-08-22 14:10:51

nagios

2010-08-17 13:36:49

DIV CSS設(shè)計

2011-02-22 14:00:16

vsftpd

2011-04-21 16:42:40

傳真機

2009-02-18 09:30:10

AJAX跨域XML

2012-03-20 10:21:01

App Store刷排名

2009-07-17 10:01:14

Swing和AWT

2010-08-31 13:49:12

CSS

2010-09-06 10:24:31

無線路由器掉線問題

2010-12-27 11:00:53

Virtualbox

2010-01-27 12:06:00

UPS常見故障

2012-05-30 16:19:11

2012-07-31 16:06:28

Linux內(nèi)核編譯

2010-05-17 10:01:09

MySql字符集

2011-05-06 17:25:58

硒鼓

2012-12-12 15:19:32

云安全
點贊
收藏

51CTO技術(shù)棧公眾號