jquery iframe css firefox bug?

Without going in to detail on what these methods do, can anyone tell me why I get these weird results? getCurrentIframe().findInIframe("h2").css("paddingLeft") // gives me "20px" how ever if I do .get(0) or [0] to get the dom-element and then rewrap it in a $ I get: $( getCurrentIframe().findInIframe("h2")[0]).css("paddingLeft") //it gives me "0px" When I do an `.each`, `$(this).css("paddingLeft")` (within the each loop) also gives me 0px. Im also getting different results on paddingLeft when I use this(from the parent window): `iframe.contentWindow.$(selector).css("paddingLeft") //gives me 20px` but `iframe.contents().find(selector).css("paddingLeft") //gives me 0px` It seems that firefox is uncapable to find the correct css in iframes on an element unless it has the styles set inline. (like for example: if body has font-size:18 in css, but the elements css has font-size:40px, it will return 18px) *boggled* **added:** getCurrentIframe().findInIframe("h2").each(function() { console.log($(this).css("paddingLeft")) }).css("paddingLeft") this prints out in firefox 0px 20px. How ever in chrome it prints out 20px 20px

以上就是jquery iframe css firefox bug?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏