Giter Club home page Giter Club logo

jquery-instagram's Introduction

Instagram jQuery plugin

A simple jQuery plugin to show a list of Instagram photos.

Usage

Import the script

<script src="jquery.instagram.js"></script>

Insert an empty div in the code

<div class="instagram"></div>

Run the plugin

$(function() {
  $(".instagram").instagram({
      hash: 'love'
    , clientId: 'YOUR-CLIENT-ID-HERE'
  });
});

Alternative method.

This expects a div with class instagram and a button element. When clicked, the button paginates through the search, allowing you to show more than the API limit of 20 photos.

<div class="instagram"></div>
<button>More</button>
$(function(){
  var
    insta_container = $(".instagram")
  , insta_next_url

  insta_container.instagram({
      hash: 'hipster'
    , clientId : 'YOUR-CLIENT-ID-HERE'
    , show : 18
    , onComplete : function (photos, data) {
      insta_next_url = data.pagination.next_url
    }
  })

  $('button').on('click', function(){
    var 
      button = $(this)
    , text = button.text()

    if (button.text() != 'Loading…'){
      button.text('Loading…')
      insta_container.instagram({
          next_url : insta_next_url
        , show : 18
        , onComplete : function(photos, data) {
          insta_next_url = data.pagination.next_url
          button.text(text)
        }
      })
    }		
  }) 
});

Authentication

You can obtain a client id registering a new Instagram API client app at http://instagr.am/developer/register/

Options

hash

Search recent photos tagged with hash. See also http://instagram.com/developer/endpoints/tags/#get_tags_media_recent

Authentication: clientId required

Type: String

Default: null

userId

Search recent by user userId. See also http://instagram.com/developer/endpoints/users/#get_users_media_recent

Authentication: accessToken required.

Type: String

Default: null

locationId

Search recent from location locationId. See also http://instagram.com/developer/endpoints/locations/#get_locations_media_recent

Authentication: clientId required.

Type: String

Default: null

search

Search for media in a given area. See also http://instagram.com/developer/endpoints/media/#get_media_search

Authentication: clientId required.

Type: Object

Default: null

accessToken

OAuth 2 access token. See also http://instagram.com/developer/auth/

Type: String

Default: null

clientId

OAuth 2 client application id. See also http://instagram.com/developer/auth/

Type: String

Default: null

show

Number of photos to show.

Type: Number

Default: null

next_url

You can populate this with the next URL object (pagination.next_url) returned by the Instagram API.

Type: URL

Default: null

image_size

Image size to display. Choose one between 'low_resolution', 'thumbnail' or 'standard_resolution'.

Type: String

Default: 'thumbnail'

onLoad

Called just before making the request to instagram API.

Type: Function

Default: null

onComplete

Called after the response from instagram API.

Type: Function

Default: null

jquery-instagram's People

Contributors

potomak avatar adrianartiles avatar joeybaker avatar tsharju avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.