我无法让带有 jquery 和 ajax 的页面正常工作。我试图使这个例子尽可能简单。jquery 在单个页面上时可以工作,但在通话后我无法让它工作。
2 页,第一页:
<!DOCTYPE html>
<html>
<head>
<script src="../js/jquery-1.8.2.min.js"></script>
<style type='text/css'>
#one {
width: 200px;
height: 200px;
background: red;
}
#two{
width: 200px;
height: 200px;
background: blue;
}
.show {
display: none;
background: yellow;
}
</style>
<script>
$(document).ready(function() {
$("button").click(function() {
$("#div1").load("definition.jsp");
});
});
</script>
<script type="text/javascript">
$('#wrapper').on('mouseenter', '.touch', function() {
$(this).next('.show').fadeIn(800);
}).on('mouseleave', '.touch', function() {
$(this).next('.show').delay(800).fadeOut(800);
});
</script>
</head>
<body>
<div id="div1"><h2>jQuery AJAX Test</h2></div>
<button>Get External Content</button>
</body>
第二页:
<div id="wrapper">
<div id="parent_one">
<div class="touch" id="one">Enter</div>
<div class="show">Works</div>
</div>
<div id="parent_two">
<div class="touch" id="two">Enter</div>
<div class="show">Second Works</div>
</div>
有任何想法吗?请帮忙!