how to compute Facebook graph api cover offset_y to pixel?

前端 未结 6 2046
故里飘歌
故里飘歌 2020-12-17 05:54

I can retrieve facebook cover source and offset_y from graph api for example -

https://graph.facebook.com/Inna

I get this -

\"cover\": {
           


        
6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-17 06:43

    Yes i actually found the answer myself. The offset that facebook sends is in percentage!

    The following worked perfectly -

        FB.api(artist, function (data) {
                                $('.ed-cover img').attr('src', data.cover.source)
    .css("top", (-1 * data.cover.offset_y) + '%');
                            });
    

提交回复
热议问题