2013-09-26 58 views
2

我在電話缺口是新的改變點擊顏色,這是我的代碼
按鈕並不在手機的差距

<div class="ui-grid-a" align="center" style="margin-left: 4px;" > 
    <div class="ui-block-a" data-role="content" style="margin-top: 10px;height: 107px;width: 120px;" align="center"> 
<a data-role="button" id="btnMyVisit" data-theme="my-site" style="height: 107px;width: 120px;" data-transition="none" data-mini="true" data-prefetch="true" href="#myVisit"> 
<img src="img/MyVisit.png" id="myvisitid" style="vertical-align: middle;margin-bottom:0px;margin-left:0px; height: 112px;width: 120px;"> </a> 
      </div> 

我的問題是,每當我按一下按鈕它之前沒有改變其顏色訪問鏈接...我想在訪問前改變它的顏色,以便用戶可以知道他只是點擊了這個鏈接.....

回答

1

你能解決這個使用CSS:

.btnMyVisit:active { 
    // Change something, eg the background color: 
    background-color: pink; 
} 
0

你可以手動添加類「ui-btn-active」到用戶點擊並會改變顏色的按鈕。然後重寫「ui-btn-active」css樣式,將其設置爲所需的顏色。

+0

我試過,但按鈕不閃爍前訪問鏈接..只是簡單地訪問頁面,並沒有顯示任何顏色,而點擊 – user2819620

0

根據烏拉圭回合REQ使用下面的代碼。 ,我相信這會幫助你。

function changePage(divId, pageTransition, reverseTransition, changeHash){ 
var pageTransition1 = typeof(pageTransition) != 'undefined' ? pageTransition : 'none'; 
var reverseTransition1 = typeof(reverseTransition) != 'undefined' ? reverseTransition : false; 
var changeHash1 = typeof(changeHash) != 'undefined' ? changeHash : true; 

    $.mobile.changePage('#'+divId, { 
    transition: pageTransition1, 
    reverse: reverseTransition1, 
    changeHash: changeHash1 
    }); 

} 

$("#btnMyVisit").click(function() { 
//this changes the color of your link... 
$(this).css('color','red'); 



setTimeout(function(){    

    //something you want delayed by 3 sec 
    // now write code for the event you wanna perform 
    changePage('myVisit', 'slideup', true, true); 

    }, 3000); 


}); 

此外,

變化的href = 「#myVisit」 到HREF = 「JavaScript的:無效(0)」,在你的錨標記。