F
F
fron3332020-08-31 12:28:09
JavaScript
fron333, 2020-08-31 12:28:09

After downloading articles, the player script does not work?

I have content loaded using ajax and in some articles I use the jwplayer player, but after loading the articles the player script does not work. Here is the output code of the player

<div id='38'></div>
  <script type="text/javascript">
  var playerInstance = jwplayer("38");
playerInstance.setup({
    file: "https://www.youtube.com/watch?v=WrBLHH3WZ5M",
    width: "100%",
       height: "100%"
});
</script>


Here is the loading script

jQuery(document).ready(function($) {
        var $container = $('#masonry');
            
            $container.infinitescroll({
                navSelector : '#navigation',
                nextSelector : '#navigation #navigation-next a',
                itemSelector : '.item',
                maxPage       :5,
 loading: {
     
            msgText: '<?php _e('Loading', 'prpin') ?>',
            finishedMsg: '<?php _e('All items loaded', 'prpin') ?>',
            img: '<?php echo get_template_directory_uri(); ?>/img/loading.gif', 
            
    }
},
            
// запускаем Masonry как обратный вызов
            function(newElements) {
// скрываем новые элементы во время загрузки
                var $newElems = $(newElements).css({
                    opacity: 0});           
// убедитесь, что изображения загружаются перед добавлением в макет кладки
                $newElems.imagesLoaded(function() {
                    // показать элементы, теперь они готовы
$newElems.animate({
                        opacity: 1});
                    $container.masonry('appended', $newElems, true);
                    
                    
                });
                onAfterLoaded($newElems);
        }
            );
            
    });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fron333, 2020-09-11
@fron333

No, just after loading articles through Ajax, the player no longer works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question