我有一個div在頁面的中心。我有身體背景圖像。 我只需要在背景圖像上使用jquery點擊。 如果您單擊帶有divPage的div,則不會發生任何情況。jquery - 背景圖像點擊
感謝您的建議或可能的其他解決方案。
HTML:
<body>
<form id="formBackground" method="post">
<div id="divPage">
Text.
</div>
</form>
</body>
CSS
body{
padding: 0px;
margin: 0px;
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 12px;
color: white;
background-image: url('../images/backgrounds/bg.jpg');
background-repeat:no-repeat;
background-position:top;}
div#divPage{
width: 800px;
height: 300px;
margin: auto;}
我想這一點,但它不能正常工作:
$('body').click(function() {
alert("Click");
})
這是單擊帶有DIV id id divPage。
這是不可能的。點擊後背景圖片不會被點擊測試。 – Tejs
你想獲得divPage以外的點擊嗎? –