@behance/beff
Advanced tools
Comparing version 9.0.0 to 9.1.0
@@ -15,2 +15,4 @@ define([ | ||
this.$context = options.$context; | ||
this.leftBoundaryWidth = options.leftBoundaryWidth; | ||
this.initialPenLeftPosition = null; | ||
@@ -33,3 +35,5 @@ this.penTopPosForShortModules = -10; | ||
this.$context.on('mouseup.stickyPenScroller', '.js-pen', function(e) { | ||
this._adjustDropdownFromPen($(e.currentTarget)); | ||
var $pen = $(e.currentTarget); | ||
this._checkAndSetLeftBoundaryForPen($pen); | ||
this._adjustDropdownFromPen($pen); | ||
}.bind(this)); | ||
@@ -55,2 +59,3 @@ | ||
$pen.css('top', offsettedScrollTop - moduleOffsetTop + this.penMargin); | ||
this._checkAndSetLeftBoundaryForPen($pen); | ||
this._fixDropDownPosition($dropdown, $pen); | ||
@@ -60,5 +65,7 @@ } | ||
$pen.css('top', this.penTopPosForShortModules); | ||
this._checkAndSetLeftBoundaryForPen($pen); | ||
} | ||
else { | ||
$pen.css('top', this.penMargin); | ||
this._checkAndSetLeftBoundaryForPen($pen); | ||
this._fixDropDownPosition($dropdown, $pen); | ||
@@ -98,2 +105,3 @@ } | ||
$dropdown.css('top', $pen.position().top + penHeight + this.dropDownMargin); | ||
this._checkAndSetLeftBoundaryForDropdown($pen, $dropdown); | ||
}.bind(this), 1); | ||
@@ -103,2 +111,3 @@ } | ||
$dropdown.css('top', $pen.position().top + penHeight + this.dropDownMargin); | ||
this._checkAndSetLeftBoundaryForDropdown($pen, $dropdown); | ||
}, | ||
@@ -112,2 +121,24 @@ | ||
_checkAndSetLeftBoundaryForPen: function($pen) { | ||
if (this.leftBoundaryWidth) { | ||
if (!this.initialPenLeftPosition) { | ||
this.initialPenLeftPosition = $pen.position().left; | ||
} | ||
if ($pen.offset().left <= this.leftBoundaryWidth) { | ||
$pen.css('left', (this.leftBoundaryWidth - $pen.offset().left) + $pen.position().left); | ||
} | ||
else { | ||
$pen.css('left', this.initialPenLeftPosition); | ||
} | ||
} | ||
}, | ||
_checkAndSetLeftBoundaryForDropdown: function($pen, $dropdown) { | ||
if (this.leftBoundaryWidth) { | ||
if ($pen.offset().left < this.leftBoundaryWidth + this.dropDownMargin) { | ||
$dropdown.css('left', $pen.position().left + 1); // +1 to show left shadow of dropdown | ||
} | ||
} | ||
}, | ||
_positionPenForShortModules: function() { | ||
@@ -118,2 +149,3 @@ this.$modules.on('mouseenter.stickyPenScroller', function(e) { | ||
this._checkAndSetLeftBoundaryForPen($pen); | ||
if ($module.outerHeight() < $pen.outerHeight()) { | ||
@@ -120,0 +152,0 @@ $pen.css('top', this.penTopPosForShortModules); |
{ | ||
"name": "@behance/beff", | ||
"version": "9.0.0", | ||
"version": "9.1.0", | ||
"description": "Behance Frontend Framework", | ||
@@ -5,0 +5,0 @@ "directories": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1531738
109
13245
1