I can retrieve facebook cover source and offset_y from graph api for example -
https://graph.facebook.com/Inna
I get this -
"cover": {
"cover_id": "10151356812150381",
"source": "http://sphotos.xx.fbcdn.net/hphotos-snc7/s720x720/419277_10151356812150381_302056140380_23114100_97822830_n.jpg",
"offset_y": 54
}
But when i look at the actual facebook page for this, i see the top offset is -135px.
How is that calculated from 54?
I want to display someones cover photo on my website, with the same offset as facebook. So I am basically doing -
<div class="ed-cover">
<img src=""/>
</div>
CSS -
.ed .ed-cover
{
height:315px;
overflow:hidden;
position:relative;
}
.ed .ed-cover img
{
width:100%;
position:absolute;
}
JS -
FB.api(artist, function (data) {
$('.ed-cover img').attr('src', data.cover.source).css("top", -1 * data.cover.offset_y);
});
But the CSS offset here for the "top" property is incorrect as i get back 54 and the real offset is -135px;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…