簡體   English   中英

使用jQuery在元素上顯示氣球消息

[英]Balloon message on element using jQuery

當我將鼠標懸停在網站中的某些元素上時,我想顯示帶有標題的氣球消息。 我看到了jQuery代碼,但不知道是否以正確的方式使用它。

這是我的代碼:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
<script type="text/javascript" src="./js/jquery.balloon.js">
</script>

<script>
    $(document).ready($(function() {
        $('#style1').balloon({ position: "bottom right"});
    });
</script>
</head>
<body>
    <div id="wrap">

        <button id="style1" onclick="getValue('./CSS/style1.css')">style1</button>

    </div>
</body>

您能幫我這個鏈接嗎,我用過http://file.urin.take-uma.net/jquery.balloon.js-Demo.html

有幾件事情可能是錯誤的,並且可以肯定。

  • 僅當目標元素具有title屬性時,氣球插件才會制作氣球。 您的button沒有。

    確保它具有title屬性。

  • 確保您的js文件位於給定位置./js/jquery.balloon.js ,請嘗試按f12並轉到控制台選項卡,看看是否發現任何錯誤。

將標題屬性添加到您的按鈕

        <button id="style1" onclick="getValue('./CSS/style1.css')" title="Some">style1</button>

JsFiddle示例

標題丟失。 <button id =“ style1” onclick =“ getValue('./ CSS / style1.css')” title =“ YourTitleHere” >>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
<script type="text/javascript" src="./js/jquery.balloon.js">
</script>

<script>
    $(document).ready($(function() {
        $('#style1').balloon({ position: "bottom right"});
    });
</script>
</head>
<body>
    <div id="wrap">
<button id="style1" onclick="getValue('./CSS/style1.css')" title="YourTitleHere">style1</button>

    </div>
</body>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM