Simple JavaScript file to load Instagram pictures of a certain tag or user and infinite scroll through them.
Link to the instagram-scroll.js source file in your webpage. JQuery is required.
<script>
InstagramScroll({tag: "cats", clientID: "token", imageContainer: "#pics"})
</script>
This will add a ul
to any object on the page with an ID of 'pics' filled with 20 of the most recent Instagram images tagged with 'cats'.
The three necessary parameters for using the function are:
tag
/user
- search term or user name for the imagesclientID
- given through the Instagram Developer APIimageContainer
- the DOM element where theul
containing the images will be inserted
Optional parameters include:
includeCaption
- add the caption in text after the picture. Default isfalse
.includeUsername
- add the username in text after the picture. Default isfalse
.scrollDistance
- distance in pixels from bottom of page scroll bar needs to be for new images to be loaded. Default is350
.imageSize
- size in pixels of the loaded. Default is200
.imageQuality
- size of image loaded, can either be 'thumbnail', 'low_resolution', or 'standard_resolution'. Default isstandard_resolution
.