2015-06-27 55 views
2

我使用cordova平臺的離子框架。對元件的激活狀態的CSS(DIV,按鈕或)在瀏覽器開發/測試期間工作正常,但不是在所有在機器人設備/仿真器離子和科爾多瓦-css活動不工作在Android設備

我已經定義了一些類

.bg-dark { 
background: #333333 !important; 
} 

.bg-active-darkBlue:active { 
background: #16499a !important; 
} 

和以下HTML

<a class="fg-white bg-active-darkBlue button" style="background-color:#3B5998;">Sign in with Facebook</a> 

甚至試過這種(上了車離子論壇)

<a ng-mousedown="class='bg-active-darkBlue'" ng-mouseup="class='bg-dark'" menu-close class="fg-white {{class}}">Sign in with Facebook</a> 

嘗試了一個,div和button標籤。 仍然不能在android上運行,只能在瀏覽器中運行,請幫助。

回答

3

根據經驗,角度ng-mousedownng-mouseup事件在移動設備上不會啓動。我的經驗是iOS上的離子1.6.4。

但是,on-touch和on-release的工作完美無瑕。因此,只需分別將ng-mousedownng-mouseup分別替換爲on-touchon-release

<a on-touch="class='bg-active-darkBlue'" on-release="class='bg-dark'" menu-close class="fg-white {{class}}">Sign in with Facebook</a>

這裏是pointeron-touchon-release和事件離子參考文檔。

希望這有助於..

+0

hoo謝謝@mcku,它適用於Ionic angularjs cordova android設備 – DonFabiolas

0

顯然,這樣做的「正確」的方式是根據 phonegap-tips.com是在元素上添加一個ontouchstart="return true;"

例如。

<a class="bg-active-darkBlue" ontouchstart="return true;">:active now works in cordova</a> 

這對我很有用,所以我希望它也適用於您。

相關問題