Lines Matching full:this
12 this.$el = $el;
14 this.$window = $(window);
15 this.fixedPoint = '';
16 this.pinPoint = false;
17 this.fixedPointjQ = false;
18 this.pinPointjQ = false;
19 this.offset = 0;
20 this.pinOffset = 0;
21 this.top = 0;
22 this.constrainEl = true;
23 this.state = false;
24 this.measurements = {
30 this.setup();
32 var scope = this;
35 this.$window.on('scroll load', function() {
40 this.$el.on('gumby.initialize', function() {
49 var scope = this;
51 this.fixedPoint = this.parseAttrValue(Gumby.selectAttr.apply(this.$el, ['fixed']));
54 this.pinPoint = Gumby.selectAttr.apply(this.$el, ['pin']) || false;
57 this.offset = Number(Gumby.selectAttr.apply(this.$el, ['offset'])) || 0;
60 this.pinOffset = Number(Gumby.selectAttr.apply(this.$el, ['pinoffset'])) || 0;
63 this.top = Number(Gumby.selectAttr.apply(this.$el, ['top'])) || 0;
66 this.constrainEl = Gumby.selectAttr.apply(this.$el, ['constrain']) || true;
67 if(this.constrainEl === 'false') {
68 this.constrainEl = false;
72 this.$parent = this.$el.parents('.columns, .column, .row');
73 this.$parent = this.$parent.length ? this.$parent.first() : false;
74 this.parentRow = this.$parent ? !!this.$parent.hasClass('row') : false;
77 if(this.pinPoint) {
78 this.pinPoint = this.parseAttrValue(this.pinPoint);
81 this.fixedPointjQ = this.fixedPoint instanceof jQuery;
82 this.pinPointjQ = this.pinPoint instanceof jQuery;
85 if(this.$parent && this.constrainEl) {
87 this.measure();
89 this.$window.resize(function() {
100 var scrollAmount = this.$window.scrollTop(),
102 fixedPoint = this.fixedPointjQ ? this.fixedPoint.offset().top : this.fixedPoint,
107 if(this.pinPoint) {
108 pinPoint = this.pinPointjQ ? this.pinPoint.offset().top : this.pinPoint;
112 if(this.offset) { fixedPoint -= this.offset; }
113 if(this.pinOffset) { pinPoint -= this.pinOffset; }
116 if((scrollAmount >= fixedPoint) && this.state !== 'fixed') {
118 this.fix();
121 } else if(scrollAmount < fixedPoint && this.state === 'fixed') {
122 this.unfix();
125 } else if(pinPoint && scrollAmount >= pinPoint && this.state !== 'pinned') {
126 this.pin();
132 Gumby.debug('Element has been fixed', this.$el);
133 Gumby.debug('Triggering onFixed event', this.$el);
135 this.state = 'fixed';
136 this.$el.css({
137 'top' : this.top
141 if(this.$parent) {
142 this.constrain();
148 Gumby.debug('Element has been unfixed', this.$el);
149 Gumby.debug('Triggering onUnfixed event', this.$el);
151 this.state = 'unfixed';
152 this.$el.addClass('unfixed').removeClass('fixed pinned').trigger('gumby.onUnfixed');
157 Gumby.debug('Element has been pinned', this.$el);
158 Gumby.debug('Triggering onPinned event', this.$el);
159 this.state = 'pinned';
160 this.$el.css({
161 'top' : this.$el.offset().top
167 Gumby.debug("Constraining element", this.$el);
168 this.$el.css({
169 left: this.measurements.left,
170 width: this.measurements.width
178 this.measurements.left = this.$parent.offset().left;
179 this.measurements.width = this.$parent.width();
182 if(this.parentRow) {
183 parentPadding = Number(this.$parent.css('paddingLeft').replace(/px/, ''));
185 this.measurements.left += parentPadding;
197 return this.$el.offset().top;
212 var $this = $(this);
214 // this element has already been initialized
216 if($this.data('isFixed') && !all) {
219 // this element has already been initialized
221 } else if($this.data('isFixed') && all) {
222 $this.trigger('gumby.initialize');
227 $this.data('isFixed', true);
228 new Fixed($this);