Giter Site home page Giter Site logo

right-left-select's Introduction

Right-to-left select

Starts with self-invoking anonymous function (standard jQuery structure).

a.k.a. immediately invoked function expression

(function($) . . . )(jquery);

Means: take the global window.jquery variable, pass it in referencing it with $ variable in the function (i.e. jQuery style).

You create the plugin object with the tunaselect() call and that's where you pass in your option settings. Note the $.extend call which will merge your options with the defaults.

userContainer is the enclosing

for the widget. At line 265, we use $.fn to make tunaSelect() a method on all HTML objects. So I can invoke it with $("#myDiv").tunaSelect()

Line 37: you attach the JSON data to populate the left/right sides using the HTML5 data attribute of the containing div.

The var section declares private variables.

var defaults define the properties that can be passed in

Assumes there are HTML elements with id's of 'leftSelect' and 'rightSelect'

Scroll down to line 257: these are the functions that will be publicly exposed.

The methods are defined starting at line 38.

Several of these methods call paint(). We are following a separation of model and view here. Most of the exposed functions are making operations on the model data. Only when paint() is called is it rendered to the browser.

right-left-select's People

Contributors

gregsandell 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.