JQuery 删除功能时闪烁
JQuery Flicker on Remove Function
找不到关于此特定场景的任何答案。
不育系:Joomla
我在页面上使用 jquery,该页面将被 iframed 以抑制中央 index.php header class.
中包含的徽标、菜单项等
在要iframed的页面上的以下代码工作正常,但闪烁(常见问题正确):
jQuery(function() {
jQuery('.help').remove();
jQuery('.dropdown').remove();
jQuery("header").css("height", " 0px");
jQuery("header").css("width", "0px");
jQuery(":header").css({
width: "0px",
height: "0px"
});
我看到了一些关于 document.write 的解决方案,它们可能会起作用,但请注意我无法更改 index.php 文件中的 html,我必须找到一些方法在页面加载期间或之前更改(对于页面加载 iframe)
非常感谢任何帮助!
这是将用于 iframing 的页面示例(有时 classes 不会加载,我认为这是由于 flickering/jolting 时 jquery开始:link
如果您可以更改文档的 CSS 代码,请向其添加以下样式属性:
.help,
.dropdown {
display: none;
}
header,
:header {
height: 0px;
width: 0px;
}
如果您无法更改页面的 CSS,请使用以下代码片段来处理您的问题(文件需要包含在头部,然后再加载元素):
<head>
<script type="text/javascript" src="jquery.js"></script">
<script type="text/javascript" src="file.js"></script>
</head>
file.js(不在$(document).ready()
之内):
$('<style type="text/css">.help, .dropdown { display: none; } header, :header { height: 0px; width: 0px; }</style>').appendTo('head');
找不到关于此特定场景的任何答案。 不育系:Joomla 我在页面上使用 jquery,该页面将被 iframed 以抑制中央 index.php header class.
中包含的徽标、菜单项等在要iframed的页面上的以下代码工作正常,但闪烁(常见问题正确):
jQuery(function() {
jQuery('.help').remove();
jQuery('.dropdown').remove();
jQuery("header").css("height", " 0px");
jQuery("header").css("width", "0px");
jQuery(":header").css({
width: "0px",
height: "0px"
});
我看到了一些关于 document.write 的解决方案,它们可能会起作用,但请注意我无法更改 index.php 文件中的 html,我必须找到一些方法在页面加载期间或之前更改(对于页面加载 iframe) 非常感谢任何帮助!
这是将用于 iframing 的页面示例(有时 classes 不会加载,我认为这是由于 flickering/jolting 时 jquery开始:link
如果您可以更改文档的 CSS 代码,请向其添加以下样式属性:
.help,
.dropdown {
display: none;
}
header,
:header {
height: 0px;
width: 0px;
}
如果您无法更改页面的 CSS,请使用以下代码片段来处理您的问题(文件需要包含在头部,然后再加载元素):
<head>
<script type="text/javascript" src="jquery.js"></script">
<script type="text/javascript" src="file.js"></script>
</head>
file.js(不在$(document).ready()
之内):
$('<style type="text/css">.help, .dropdown { display: none; } header, :header { height: 0px; width: 0px; }</style>').appendTo('head');