2014-03-27 74 views
0

我有一些代碼在鏈接懸停時顯示消息。這是使用工具提示,最初在頁面加載它工作正常。當我單擊一個單選按鈕時,我的問題發生,這反過來將類tooltipbfile的文本更改爲我想要的,但是當我單擊以更改文本時,它似乎已經失去了懸停功能。沒有工具提示顯示。我是否必須在某處啓用mouseenter事件。我看過像$(".tooltipbfile").prop('enabled', true);這樣的代碼,但它沒有任何區別。啓用jQuery鼠標懸停事件

如果有人能夠向我展示在點擊事件後重新啓用鼠標事件的正確方法,我將不勝感激。謝謝

更新:根據tooltipster API。 $( 「tooltipbfile」)tooltipster( '禁用');

jQuery代碼

$(function() { 
$('input:radio').click(function(){ 
    if($(this).val()=='New Intake'){ 
    $("#fileref").hide(); 
    $(".maxbox").show(); 
    $("#INTKAddMoreFileBox").show(); 
    $(".tooltipbfile").text("Help"); 

    }else if($(this).val()=='New Intake Files'){ 
    $("#fileref").show(); 
    $(".maxbox").hide(); 
    $(".tooltipbfile").text("Some text here.").show(); 
    $("#INTKAddMoreFileBox").hide(); 
    $(".tooltipbfile").tooltipster('disable'); 
    } 

}); 
}); 

Tooltipster代碼

正常工作在頁面加載

<script type="text/javascript"> 
$(document).ready(function() { 
      $('.tooltipbfile').tooltipster({ 
      theme: 'tooltipster-light', 
      position: 'right', 
      animation: 'fade', 
      fixedWidth: 200, 
      maxWidth: 290, 
      content: $('<span>blah blah blah</span>') 
      }); 
     }); 
</script> 

HTML

相關部分

<div class="fieldset"> 
    <h1><span>Enter Box(es) Reference</span></h1> 
    <p> 
    <a href="#" id="INTKAddMoreFileBox" class="btn btn-info">Add More Boxes</a> 
    <span class="maxbox" style="margin-left:10px;font-size:10px;color: grey;">(Maximum 8)</span> 
    <!--<div class="bxhelp"> 
     You now have the ability to input more than 1 box just by clicking the Add More boxes link. Please only enter 1 box reference per box. You can enter up to a maximum of 8 boxes. 
     <a href="javascript:void(0)" class="boxhelpcls">Close</a> 
     </div>--> 
    <div id="INTKInputsWrapper"> 
    <p> 
     <input name="box_add[]" type="text" required="required /> 
     <a href="javascript:void(0)" class="removeclass"></a> 
     <a style="margin-left: 14px;" href="javascript:void(0)" class="tooltipbfile">Help</a> 
    </p> 
    </div> 
    </p> 
</div> 
<div class="fieldset" id="fileref"> 
    <h1><span>Enter File References</span></h1> 
    <p> 
    <a href="javascript:void(0)" id="BFINTKAddMoreFile" class="btn btn-info">Add More Files</a> 
    <span class="fmaxbox" style="margin-left:10px;font-size:10px;color: grey;">(Maximum 8)</span> 
    <!--<div class="fbxhelp"> 
     You now have the ability to input more than 1 file just by clicking the Add More files link. You can enter up to a maximum of 8 files. 
     <a href="javascript:void(0)" class="fboxhelpcls">Close</a> 
     </div>--> 
    <div id="BFINTKInputsWrapper"> 
    <p> 
     <input name="bfile_add[]" id="bfile_add[]" type="text" required="required" /> 
     <a href="javascript:void(0)" class="removeclass"></a> 
     <a style="margin-left: 14px;" href="javascript:void(0)" class="fboxhelp">Help</a> 
    </p> 
    </div> 
    </p> 
</div> 
+1

爲你的問題做一個樣品小提琴演示 – Rex

+0

你能發佈你的html嗎? – francadaval

+0

@Rex試圖做一個小提琴,但沒有到tooltipster庫的外部鏈接。謝謝 – user1532468

回答

0

單擊對象將其放回一個tooltipbfile後,只需重新調用它tooltipster(),因爲程序不上的document.ready:

.tooltipster({ 
     theme: 'tooltipster-light', 
     position: 'right', 
     animation: 'fade', 
     fixedWidth: 200, 
     maxWidth: 290, 
     content: $('<span>blah blah blah</span>') 
     }); 

我從來沒有用過tooltipster,但這應該管用。

+0

我究竟在哪裏放這個。它是否需要處於「新建攝入文件」的點擊功能中,因爲它已經在頁面加載中。不太確定我遵循你的答案。謝謝 – user1532468

+0

FYI Tooltipster帶有一個如下禁用選項:$(「。tooltipbfile」)。tooltipster('disable');作品太:-)我會在我的代碼發佈。謝謝 – user1532468

+0

$(「。tooltipbfile」)。text(「Some text here。」)。show(); - 在此之後 – Blake