抱歉,标题...所以我将index.html分隔为div,然后使用以下命令调用了contant:
<script>$(function(){$("#work_bunch").load("wb.html"); });</script>
它工作正常,但我不会在wb.html中的元素上使用jquery,我在index中使用了它:
<script type="text/javascript" src="java_scripts/wb_op.js"></script>
我在.js
文件中写的内容似乎在索引中都可以正常工作,但是我无法在其中选择任何元素wb.html
例如(如果img5是wb.html元素):
$("#img5").mouseover(function(){
$(img5).fadeOut(2000);
});
您需要使用事件委托:
$(document).on('mouseover', '#element_in_wb_page', function() {
// your function
});
在您的情况下:
$(document).on('mouseover', '#img5', function() {
$(this).fadeOut(2000);
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句