【发布时间】:2017-09-05 07:55:51
【问题描述】:
我在 shopify 的 iframe 中添加 Css。但它不工作.. 这是我的代码。
<script>
$('#twitter-widget-0').load(function() {
var css = '<style type="text/css"> body {background: white};</style>';
$('#twitter-widget-0').contents().find("head").append(css);
});
</script>
【问题讨论】:
-
使用.css函数。 $('#twitter-widget-0').contents().find("head").css('background-color','white')
-
它仍然无法正常工作。你还有其他选择吗?
-
你确定你的 jquery 选择器是正确的吗?它是否指向正确的 DOM?
-
很确定,实际上我正在尝试更改 iframe 中
标记的样式。如果您有其他代码。你能帮帮我吗?
-
你不能像这样将 html 注入到 iframe 中。出于安全考虑,不允许这样做
标签: javascript html css iframe shopify