我有兩個不同文件的場景,我需要在另一個文件中加載一個html。如何在另一個文件的html上加載js動作
Iframe.html的:
<select data-placeholder="Choose a Country..." class="flexselect">
<option value=""></option>
<option value="United States">United States</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Algeria">Algeria</option>
<option value="Bermuda">Bermuda</option>
<option value="Bhutan">Bhutan</option>
</select>
<iframe src="index.html" style="width:100%; border: 0px solid #fff;"></iframe>
的index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="http://rmm5t.github.io/jquery-flexselect/flexselect.css">
</head>
<body>
<script src="http://code.jquery.com/jquery-1.6.4.js" type="text/javascript"></script>
<script src="http://rmm5t.github.io/jquery-flexselect/jquery.flexselect.js" type="text/javascript"></script>
<script src="http://rmm5t.github.io/jquery-flexselect/liquidmetal.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("select.flexselect").flexselect();
});
</script>
</body>
</html>
它不會顯示在其沒有工作過,同時任何錯誤。我所觀察到的是,它不在iframe標籤上方的select標籤上觸發。
如果我將選擇標記內容保留在index.html
頁面中,但iframe不允許顯示完整的下拉內容,則可以使用。它被限制在允許滾動的特定高度&。
所以我不能保持在iframe選擇標記,它應該走出iframe的。
我們該如何使它可行?
即使您將select添加到index.html,您也會困惑嗎? – snit80
@ snit80,是的..iframe必須在我的情況。情況就像我需要在另一個文件中加載index.html文件,所以我使用iframe。但是,當我在iframe中保留select標籤時,這是問題(http://stackoverflow.com/questions/39741412/jquery-chosen-content-not-getting-out-of-the-iframe-instead-scrolled-within- ) – kumar
你有沒有考慮給iframe一個高度? – snit80