Skip to content

Instantly share code, notes, and snippets.

@Rockncoder
Created January 22, 2013 06:58
Show Gist options
  • Select an option

  • Save Rockncoder/4592680 to your computer and use it in GitHub Desktop.

Select an option

Save Rockncoder/4592680 to your computer and use it in GitHub Desktop.
Init method of RNC Slide Panel.
Plugin.prototype = {
init:function () {
var that = this;
this.$ptr.css(this.options.side, this.collapsedX + 'px');
this.$ptr.css('top', this.options.top);
/* hook the click/tap event */
this.$ptr.click(function (evt) {
/* only activate if clicking on the panel not something on the panel */
if (event.target.id === that.$ptr.attr('id')) {
var endX = (that.isCollapsed? that.expandedX: that.collapsedX) + 'px',
option = that.options.side === 'left'? {left: endX}: {right: endX};
that.$ptr.animate(option, that.options.speed);
that.isCollapsed = that.isCollapsed ? false : true;
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment