Git Product home page Git Product 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: 'hfarm'
    , clientId: 'your-client-id-here'
  });
});

An alternative method. This expects a div with class instagram and a button. 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 : 'xxxxxxx'
    , 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)
        }
      })
    }		
  }) 
});

Options

hash

Search recent photos tagged with hash.

Type: String

Default: null

accessToken

OAuth 2 access token (see: http://instagram.com/developer/auth/).

Type: String

Default: null

clientId

OAuth 2 client application id.

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

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 joeybaker avatar tsharju avatar

Stargazers

Tony Ng avatar

Watchers

James Cloos avatar Tony Ng 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.