tumblr audio/video players + Masonry with infinite scroll

前端 未结 3 938
执念已碎
执念已碎 2020-12-01 17:49

Here\'s a test page: http://masonry-test.tumblr.com/

I\'m using jquery Masonry with infinite scroll on tumblr. All is fine except with audio players. They won\'t loa

3条回答
  •  难免孤独
    2020-12-01 18:11

    By default the API will return a white audio player. you can change it by using the jQuery method to replace the flash player with a black or white player respectively.

    .replace("audio_player.swf", "audio_player_black.swf")
    

    or simply change the color itself

    .replace("color=FFFFFF", "color=EA9D23");
    

    Example:

    $('.audio').each(function(){
            var audioID = $(this).attr("id");
            var $audioPost = $(this);
            $.ajax({
                url: '/api/read/json?id=' + audioID,
                dataType: 'jsonp',
                timeout: 50000,
                success: function(data){
                    $audioPost.append('\x3cdiv class=\x22audio_player\x22\x3e' + data.posts[0]['audio-player'].replace("audio_player.swf","audio_player_black.swf") +'\x3c/div\x3e');
                    }
                }
            });
    

    I had a lot of trouble with this and hope it helps someone out. I found the above information here Change Tumblr audio player color with Javascript.

提交回复
热议问题