我使用将相同的页面动态加载到div中。将每个页面的div加载到主页面上的两个窗格中。有用。我想要做的是让JavaScript在子页面中包含的链接上工作。这些子页面上只有一个列表。使用jQuery .load()加载的页面不响应其他JavaScript
链接必须是相对于根,但以相同方式链接JS文件不起作用。无论我说的.js文件位于何处,什么都不会发生。只是最初的.load()函数。
有没有东西我添加到代码,或找到它在哪里寻找.js文件?
这是
$(document).ready(function() {
//#left and #right are divs loading content from .content/.description
$('#left').load('demos/websites.html .content');
$('#right').load('demos/websites.html .description');
$('nav#subnav li a').click(function() {
var page = $(this).attr('href');
$('#left').load(page + ' .content');
$('#right').load(page + ' .description');
return false;
});
});
如果你认为我的问题可能会更好理解提供完整的代码你可以让我知道,我很乐意详细说明我自己的答案:) – Alexander 2013-02-26 12:38:26
:)是的,我可以。感谢您指出。 – Ankit 2013-02-26 12:45:35