0
我做一個簡單的項目,我想和方法顯示的iframe的jQuery .show()
,我告訴jQuery的主網站,我嘗試這樣做:如何顯示的iframe使用jQuery
$(function() {
// run the currently selected effect
function runEffect() {
// get effect type from
var selectedEffect = $("#effectTypes").val();
// most effect types need no options passed by default
var options = {};
// some effects have required parameters
if (selectedEffect === "scale") {
options = { percent: 100 };
} else if (selectedEffect === "size") {
options = { to: { width: 280, height: 185 } };
}
// run the effect
$("#effect").show("blind", options, 500, callback);
};
//callback function to bring a hidden box back
function callback() {
setTimeout(function() {
$("#effect:visible").removeAttr("style").fadeOut();
}, 1000);
};
// set effect from select menu value
$("#button").click(function() {
runEffect();
});
});
<link rel="stylesheet" href="css/style.css"/>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<div align="center"><b>Sorveglianza RaspiCam</b></div>
<div id="effect" class="sorv">
<iframe src='http://www.sito.it' width='1024' height='640'></iframe>
</div>
<button id="button" class="ui-state-default ui-corner-all">Run Effect</button>
但該按鈕不起作用,iframe永遠不可見,我錯了? 謝謝, 丹尼爾。
你在你的html中有一些問題。我修復了它們,現在看來它工作。是不是? –
@MoshFeu - 你是說你編輯了問題以消除問題,因此它不再是一個有效的問題? – Quentin
是的,如果我理解了這個問題,當你點擊「運行效果」按鈕時,iframe應該淡出,但不是。現在,它確實。 –