如何使用jQuery Mobile创建一个工具提示弹出窗口
jQuery Mobile是一种基于网络的技术,用于制作可在所有智能手机、平板电脑和台式机上访问的响应式内容。在这篇文章中,我们将使用jQuery Mobile创建一个工具提示弹窗。
方法:添加你的项目所需的jQuery Mobile脚本。
<link rel=”stylesheet” href=”http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css” />
<script src=”http://code.jquery.com/jquery-1.11.1.min.js”></script>
<script src=”http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js”></script>
我们可以通过在基本弹出窗口中添加一个主题色块来创建工具提示,并使用ui-content类来添加弹出窗口。
示例:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href=
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src=
"http://code.jquery.com/jquery-1.11.1.min.js">
</script>
<script src=
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js">
</script>
</head>
<body>
<center>
<h1>GeeksforGeeks</h1>
<h4>
Tooltip popup using jQuery Mobile
</h4>
<p>
GeeksforGeeks <a href="#GFGpopup"
data-transition="pop" data-rel="popup"
class="my-tooltip-btn ui-btn ui-alt-icon
ui-nodisc-icon ui-btn-inline ui-icon-info
ui-btn-icon-notext"
title="Read more...">Read more...</a>
</p>
<div data-role="popup" id="GFGpopup"
class="ui-content" data-theme="a">
<p>Welcome to GeeksforGeeks</p>
</div>
</center>
</body>
</html>
输出: