我有魔女禁用按鈕,我想提出一個效果,當鼠標經過懸停它這樣做,我有這樣的代碼:啓用時生效按鈕禁用
$commentAddTimeshitForbiden = AddPopupJQ("Button disable");
echo "<input type='button' value='Validate' $commentAddTimeshitForbiden/>";
AddPopupJQ
僅僅是一個函數誰允許在我的輸入中添加一個類,然後在參數中輸入文本。
function AddPopupJQ($text='', $title='')
{
return "class='popupjq' data-popupjq_text='" . htmlspecialchars(stripslashes($text), ENT_QUOTES | ENT_HTML401, "ISO-8859-15") . "' data-popupjq_title='" . htmlspecialchars(stripslashes($title), ENT_QUOTES | ENT_HTML401, "ISO-8859-15") . "'";
}
後我有一個jquery function
將採取誰所有誰擁有className
的元素和打印popUp
當mouse pass hover
的元素。
function popupJQ() {
$(".popupjq").each(function(index) {
//Récuperation des données/paramètres
var title = ($(this).data('popupjq_title')) ? $(this).data('popupjq_title') : '';
var text = ($(this).data('popupjq_text')) ? $(this).data('popupjq_text') : '';
//Pour l'accessibilité, on ajoute la balise Alt aux images
if ($(this).is("img")) {
var sep = (title && text) ? " : " : "";
$(this).attr("alt", title + sep + text);
}
//Création de la tooltip
var txt = "";
if (title)
txt += "<B><FONT class='tooltitle'>" + title + "</FONT></B><br>";
if (text)
txt += "<FONT class='tooltext'>" + text + "</FONT>";
if(txt){
$(this).tooltipster({
content: $(txt),
position: 'bottom-left',
delay: 100,
debug: false,
speed: 0
});
}
});
}
問題是,當按鈕被啓用時它工作,但當它被禁用時不工作。 我認爲這是因爲當按鈕是disable
時,事件懸停是停止的。我該怎麼辦才能使它工作。
包括所有相關的代碼請 –
@Kvasir把你的代碼。 – nirmal
檢查此:http://stackoverflow.com/questions/18941700/hover-not-working-on-disabled-input-field – allu