AI智能
改变未来

JS改变Iframe中指定元素的样式

改变页面中所有Iframe中指定元素的样式并设置此Iframe的高度

获取所有的Iframe对象,然后循环设置样式和高度,已封装成函数,如下:

[code]// 改变Iframe中指定元素的样式function optIframeContent(){$.each($(\'iframe\'), function(index, item){console.log();$(item.contentWindow.document).removeClass(\'index-list-status-fix\').find(\'.status-fix\').addClass(\'index-list-status-fix\');$(item.contentWindow.document).find(\'.goto-monitor\').hide();$(item).parent().height($(item.contentWindow.document).find(\'.status-fix\').height()+30);$(item).parent().children(\'.loading\').hide()});};

 

赞(0) 打赏
未经允许不得转载:爱站程序员基地 » JS改变Iframe中指定元素的样式