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 the ul
containing the images will be insertedOptional parameters include:
includeCaption
- add the caption in text after the picture. Default is false
.includeUsername
- add the username in text after the picture. Default is false
.scrollDistance
- distance in pixels from bottom of page scroll bar needs to be for new images to be loaded. Default is 350
.imageSize
- size in pixels of the loaded. Default is 200
.imageQuality
- size of image loaded, can either be 'thumbnail', 'low_resolution', or 'standard_resolution'. Default is standard_resolution
.A sample of the script in action can be seen here.