我有一个带锚标签的页面,通过以下代码转换为JQuery UI按钮。
$(document).ready(function() {
$('a.jquery-button-add').button({ icons : { primary: 'ui-icon-circle-plus' } });
});`
出于某种原因,当我按住鼠标按钮时,图标仅在按钮上可见。不按住鼠标按钮,图标就不可见了。
所有浏览器都会出现这种情况。
非常感谢帮助:)
编辑:这是我用来测试的确切代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" href="css/jquery-ui-overcast.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js"></script>
<script type="text/javascript">
<!-- jQuery click buttons -->
$(document).ready(function() {
$('a.jquery-button-add').button({ icons : { primary: 'ui-icon-circle-plus' } });
$('a.jquery-button').button();
});
</script>
</head>
<body>
<a href="#" class="jquery-button-add">My nice button</a>
</body>
</html>
答案 0 :(得分:1)
除了标准的jQuery UI CSS之外,您还必须拥有干扰here's your code in a very simple test case working。
这是锚中的<span>
,结果如下:
<a class="jquery-button-add ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon" href="#" role="button" aria-disabled="false">
<span class="ui-button-icon-primary ui-icon ui-icon-circle-plus"></span>
<span class="ui-button-text"></span>
</a>
确保您没有其他样式干扰首个<span>
的尺寸,display:block;
或overflow: hidden;
,通常导致{{>} {1}}问题。