0

我有一个带有来自facebook的like按钮的iframe,它有点小我想从左边滚动iframe 15px;

这是我的代码:

<iframe id='likebutton' frameBorder='0' allowTransparency='true' src='http://www.facebook.com/widgets/like.php?href="www.facebook.com/makestream"&amp;layout=standard&amp;show_faces=true&amp;width=53&amp;action=like&amp;colorscheme=light&amp;height=80' style='position:absolute;width:26px;height:23px;overflow:hidden;border:0;'></iframe>

有没有办法用 javascript 做到这一点?

4

2 回答 2

0

这是在 iframe 中滚动的代码:

document.getElementById('likebutton'); 
myIframe.onload = function () { 
myIframe.contentWindow.scrollTo(xcoord,ycoord); 
} 

现场示例:http: //jsbin.com/ipujo/1/edit

于 2013-02-03T21:05:54.413 回答
0

使用 javascript,您可以使用如下代码更改 CSS:

document.getElementById("likebutton").style.marginLeft="15px";

或使用 jQuery:

$("#likebutton").css("margin-left","15px");
于 2013-02-03T20:42:12.100 回答