Trying to get this code to work outside of CodePen

code: https://codepen.io/Merdzanovich/pen/poRdwqK

How would I get the code to work in JSFiddle?

code: https://jsfiddle.net/f2n5joxy/1/


<div class="container">	
<div id="instagram-feed-islemunda" class="instagram_feed"></div>
</div>

<script src="https://www.jqueryscript.net/demo/Instagram-Photos-Without-API-instagramFeed/jquery.instagramFeed.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
 (function($){
		$(window).on('load', function(){
			$.instagramFeed({
				'username': 'islemunda_010',
				'container': "#instagram-feed-islemunda",
				'display_profile': false,
				'display_biography': false,
				'display_gallery': true,
				'get_raw_json': false,
				'callback': null,
				'styling': true,
				'items': 6,
				'items_per_row': 3,
				'margin': 1
			});
		});
	})(jQuery);
  </script>

Like this: https://jsfiddle.net/4vud7y98/2/

Basically, lose the superfluous IFFE and the on load callback:

- (function ($) {
-   $(window).on('load', function () {
      $.instagramFeed({
        username: 'islemunda_010',
        container: '#instagram-feed-islemunda',
        display_profile: false,
        display_biography: false,
        display_gallery: true,
        get_raw_json: false,
        callback: null,
        styling: true,
        items: 6,
        items_per_row: 3,
        margin: 1,
      });
-   });
- })(jQuery);

Put the JavaScript in the JavaScript pane. Then include jQuery by selecting it from the dropdown at the top of the JavaScript pane and add the second script via the Resources tab on the left.

3 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.