Open kiwo12345 opened 2 years ago
I am trying to change the template depending if its a image or video but it doesnt seem to work, it just uses the template provided when calling the function
<script src="https://cdn.jsdelivr.net/gh/stevenschobert/instafeed.js@2.0.0rc1/src/instafeed.min.js"></script> <div class="instagram-module" id="instafeed"></div> <script type="text/javascript"> var feed = new Instafeed({ get: 'user', target: 'instafeed', limit: 10, template: '<a class="instagram-link" href="{{link}}" target="_blank" rel="noopener"><figure class="instagram-figure"><video controls loop><source src="' + image.model.media_url + '" type="video/mp4"/></video><figcaption class="instagram-caption" >{{caption}}</figcaption></figure></a>', resolution: 'low_resolution', accessToken: 'token', filter: function(image) { if (image.type == 'image' ) { image.template = '<img src="' + image.image + '" />'; } else { image.template = '<video controls loop><source src="' + image.model.media_url + '" type="video/mp4"/></video>'; } return true; } }); feed.run(); </script>
Did you able to solve this? I need to also write an if check inside template.
I am trying to change the template depending if its a image or video but it doesnt seem to work, it just uses the template provided when calling the function