0
我使用UI Tabs並將外部頁面加載到tabcontent-DIV時遇到問題。加載頁面後,此頁面的所有jQueries似乎都不再起作用。我讀了一些關於回調的內容,但一點都不清楚。UI Tab加載外部頁面,jQueries不再工作
例如:我通過ui-tabs加載一個外部頁面,加載的內容包含一個DIV,它應該會自動隱藏在index.html中的jQueried中 jQuery單擊事件僅用於顯示實時事件工作中。 但我無法得到自動隱藏工作,加載後的內容。
的index.html
<script type="text/javascript">
jQuery(document).ready(function() {
// define tabs
$('#tabs').tabs();
// after loading external page, the div "autohideafterload" will automatically hide.
$('#autohideafterload').hide('slow');
$('#autohideafterload').live('click', function() {
$('#autohideafterload').hide('slow');
});
});
</script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="loadcontent.html" title="tabcontent"><span>Load data</span></a></li>
</ul>
</div>
<div id="tabcontent"></div>
</body>
</html>
loadcontent.html
<div id="autohideafterload">This div will hide automatically after loaded this external page.</div>
我在想什麼?
好的,但是當我有很多要綁定這個外部加載頁面的元素時,我應該用這種方式綁定這些元素嗎?我認爲這是很多工作。沒有其他辦法嗎? – 2010-01-26 23:28:57