使用display:none; 隐藏一个元素,这个元素将不再占有原空间 “坑” 让出来了
使用 visibility:hidden;隐藏一个元素,这个元素继续占有原空间,只是“看不见”
");
window.frames["iframe_show494"].document.write(decodeHtml($("textarea#stepcodeTextarea494").val()));
window.frames["iframe_show494"].document.close();
$(window.frames["iframe_show494"]).load(function(){
$("#iframe_show494").height($("#iframe_show494").contents().find("body").height()+showittryitheight);
});
$("#iframe_show494").height($("#iframe_show494").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<style>
div.d{
display:none;
}
div.v{
visibility:hidden;
}
</style>
<div>可见的div1</div>
<div class="d">隐藏的div2,使用display:none隐藏</div>
<div>可见的div3</div>
<div class="v">隐藏的div4,使用visibility:hidden隐藏</div>
<div>可见的div5</div>
<style>
div.d{
display:none;
}
div.v{
visibility:hidden;
}
</style>
<div>可见的div1</div>
<div class="d">隐藏的div2,使用display:none隐藏</div>
<div>可见的div3</div>
<div class="v">隐藏的div4,使用visibility:hidden隐藏</div>
<div>可见的div5</div>
");
window.frames["iframe494"].document.write(decodeHtml(code494));
window.frames["iframe494"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe494"]).load(function(){
$("#iframe494").height($("#iframe494").contents().find("body").height()+showittryitheight);
});
$("#iframe494").height($("#iframe494").contents().find("body").height()+showittryitheight);
alreadyWriteCode494 = code494;
$("#rendering494").hide();
$("#rendered494").show();
}
var tRereshRetry2DemoPanel494 = setInterval(rereshRetry2DemoPanel494,1000);
var binded494 = false;
$("textarea#stepcodeTextarea494").keyup(function(){
if(!binded494){
$(window).bind('beforeunload',function(){
binded494 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code494 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code494!=newCode){
// window.frames["iframe494"].document.write("
");
// window.frames["iframe494"].document.write(decodeHtml($("textarea#stepcodeTextarea494").val()));
// window.frames["iframe494"].document.close();
// $(window.frames["iframe494"]).load(function(){
// $("#iframe494").height($("#iframe494").contents().find("body").height()+showittryitheight);
// });
// code494 = newCode;
// }
});
$(".tryButton494").click(function(){
$("#tryDiv494").show();
$("#stepcodeTextarea494").focus();
$("#stepcodeTextarea494").height(200);
$("#iframe494").height(0);
window.frames["iframe494"].document.write("
");
window.frames["iframe494"].document.write(decodeHtml($("textarea#stepcodeTextarea494").val()));
window.frames["iframe494"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe494"]).load(function(){
$("#iframe494").height($("#iframe494").contents().find("body").height()+showittryitheight);
});
$("#iframe494").height($("#iframe494").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor494.focus();
editor494.setSize(null, "250");
$("#rendering494").hide();
$("#rendered494").hide();
});
var mixedMode = {
name: "htmlmixed",
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
mode: null},
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
var editor494 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea494"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
mode:"text/html",
theme:"eclipse",
selectionPointer: true,
lineWrapping: true,
extraKeys: {
"Alt-/": "autocomplete",
"Ctrl-F": "findPersistent",
"F8": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
editor494.on("change",function(doc){
if(!binded494){
$(window).bind('beforeunload',function(){
binded494 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code494 = newCode;
$("textarea#stepcodeTextarea494").val(newCode);
if(alreadyWriteCode494!=code494){
lastModifedTime494 = new Date().getTime();
$("#rendering494").show();
$("#rendered494").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor494 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor494.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv494").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|