当我将鼠标悬停在网站中的某个元素上时,我想显示带有标题的气球消息。我看到了 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
属性时才生成气球。你的按钮
没有。确保它有一个
title
属性。确保您的 js 文件存在于给定位置
./js/jquery.balloon.js
,尝试按 f12 并转到控制台选项卡,看看是否发现任何错误。
关于javascript - 使用 jQuery 在元素上显示气球消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17131019/