http://api.jquery.com/contents/通过访问一个iframe的内容没有成功“内容()”
据说,您可以通过内容访问一个I帧DOM()方法。 我剪切并粘贴了代码,将id添加到了我的页面上的iframe,然后去了一个非常简单的div,它是iframe中唯一的div。它没有找到它。我已经成功地设法操纵iframe本身的CSS,所以我很确定一切都是正确的。 这也是所有文件准备好条件。
有问题的页面在这里http://syndex.me/tagged/belgium
希望有人能阐明这方法运作的一些情况。
感谢
$("#tumblr_controls").css({
position : 'fixed',
top : 'auto',
bottom : '15px',
}); //works
$("#tumblr_controls").contents().find("div").css("right","auto"); //doesnt work
$("#tumblr_controls").contents().find("div").css("left","0"); //doesnt work
请注意,您必须登录到tumblr才能看到问题的控制,我相信。
<iframe src="http://assets.tumblr.com/iframe.html?10&src=http%3A%2F%2Fsyndex.me%2F&lang=en_US&name=syndex&brag=0" scrolling="no" width="330" height="25" frameborder="0" style="right: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; background-color: transparent; overflow-x: hidden; overflow-y: hidden; position: fixed; top: auto; bottom: 15px; z-index: 1000007; " id="tumblr_controls">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="x-dns-prefetch-control" content="off">
<link rel="icon" href="http://assets.tumblr.com/images/favicon.gif?2" type="image/gif">
</head>
<body style="background-color:transparent; margin:0px; padding:0px;" onload="var image1 = new Image(); image1.src = 'http://assets.tumblr.com/images/iframe_like_alpha.png';
var image2 = new Image(); image2.src = 'http://assets.tumblr.com/images/iframe_like_active_alpha.png';">
<style>
img {
margin-left: 3px;
}
</style>
<div style="position:absolute; top:3px; right:3px; white-space:nowrap; height:20px;">
<form action="/follow" method="post" style="display:block; float:left;" onsubmit="_gaq.push(['_trackEvent', 'Iframe', 'Follow', 'syndex');">
<input type="hidden" name="form_key" value="4d9WHkMln7qxbqRkkU1FJ51jYk">
<input type="hidden" name="id" value="syndex">
<input type="image" src="http://assets.tumblr.com/images/iframe_follow_alpha.png?663" style="width:58px; height:20px; border-width:0px; display:block;
margin-left:3px; cursor:pointer;" alt="Follow">
</form>
<a target="_top" href="http://www.tumblr.com/dashboard"><img src="http://assets.tumblr.com/images/iframe_dashboard_alpha.png?663" alt="Dashboard" style="height:20px;
width:81px; border-width:0px; display:block; float:left; cursor:pointer;"></a>
</div>
</body></html>
</iframe>
请在问题你的代码。 ':)' –