2017-08-16 41 views
0

我有一個開始訂單按鈕this website當鼠標懸停改變圖像時。我想將相同的功能複製到開始訂單按鈕旁邊的使用當前位置按鈕。 目前,我正在使用此代碼將當前位置用作按鈕,但我也希望懸停。如何將懸停添加到任何使用jQuery的CTA

jQuery("#divSearchLocation #btnGeolocation").css({ 
    "border": "1px solid #b5b5b5", 
    "border-radius": "100px", 
    "padding": "8px", 
    "background": "#e1e1e1", 
    "box-shadow": "0 1px 2px #000", 
    "margin-top": "6px" 
}); 
jQuery(".realContent").css("color", "#353535"); 
+1

請妥善格式化您的問題 - 在我編輯它之前,這是一個難以理解的混亂。 –

+2

當適當的選擇器(例如'#divSearchLocation#btnGeolocation')可用時,在JavaScript中使用'CSS'的具體原因是什麼? –

+0

我無法找到開始訂單按鈕 –

回答

0

你可以(也許應該)用CSS做它,因爲它是對本作。 你需要先找到你的股利和使用:懸停方法

你可以把這個在你的HTML:

<style> 
    #btnGeolocation:hover { 
    color :red; //just add whatever you want, like background-image 
    } 
</style> 

,並開始在「樣式」文件夾中創建一個個人的樣式表,如果你知道如何

+0

無法做到這一點......我有這個div ID。 #divStoreTextLinksMobile – Ishan

+0

不,您的'#divStoreTextLinksMobile'包含'#btnGeolocation',因此您需要在#btnGeolocation div上設置樣式。 – Neil