Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scroll-into-view

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-into-view - npm Package Compare versions

Comparing version 1.7.4 to 1.7.5

23

example/index.browser.js

@@ -451,8 +451,8 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

if(parent === window){
x = targetPosition.left + window.scrollX - window.innerWidth * leftScalar + Math.min(targetPosition.width, window.innerWidth) * leftScalar;
y = targetPosition.top + window.scrollY - window.innerHeight * topScalar + Math.min(targetPosition.height, window.innerHeight) * topScalar;
x = targetPosition.left + window.pageXOffset - window.innerWidth * leftScalar + Math.min(targetPosition.width, window.innerWidth) * leftScalar;
y = targetPosition.top + window.pageYOffset - window.innerHeight * topScalar + Math.min(targetPosition.height, window.innerHeight) * topScalar;
x = Math.max(Math.min(x, document.body.scrollWidth - window.innerWidth * leftScalar), 0);
y = Math.max(Math.min(y, document.body.scrollHeight- window.innerHeight * topScalar), 0);
differenceX = x - window.scrollX;
differenceY = y - window.scrollY;
differenceX = x - window.pageXOffset;
differenceY = y - window.pageYOffset;
}else{

@@ -500,4 +500,2 @@ parentPosition = parent.getBoundingClientRect();

console.log(timeValue, easeValue);
setElementScroll(parent,

@@ -511,7 +509,7 @@ location.x - location.differenceX * easeValue,

}
function transitionScrollTo(target, parent, settings, callback){
var idle = !parent._scrollSettings,
lastSettings = parent._scrollSettings,
now = Date.now();
now = Date.now(),
endHandler;

@@ -525,3 +523,3 @@ if(lastSettings){

callback(endType);
parent.removeEventListener('touchstart', end);
parent.removeEventListener('touchstart', endHandler);
}

@@ -537,4 +535,6 @@

};
parent.addEventListener('touchstart', end.bind(null, CANCELED));
endHandler = end.bind(null, CANCELED);
parent.addEventListener('touchstart', endHandler);
if(idle){

@@ -607,3 +607,4 @@ animate(parent);

};
},{"raf":4}]},{},[2])
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy5udm0vdmVyc2lvbnMvbm9kZS92Ni4zLjEvbGliL25vZGVfbW9kdWxlcy93YXRjaGlmeS9ub2RlX21vZHVsZXMvYnJvd3Nlci1wYWNrL19wcmVsdWRlLmpzIiwiLi4vLi4vLm52bS92ZXJzaW9ucy9ub2RlL3Y2LjMuMS9saWIvbm9kZV9tb2R1bGVzL3dhdGNoaWZ5L25vZGVfbW9kdWxlcy9wcm9jZXNzL2Jyb3dzZXIuanMiLCJleGFtcGxlL2luZGV4LmpzIiwibm9kZV9tb2R1bGVzL2NyZWwvY3JlbC5qcyIsIm5vZGVfbW9kdWxlcy9yYWYvaW5kZXguanMiLCJub2RlX21vZHVsZXMvcmFmL25vZGVfbW9kdWxlcy9wZXJmb3JtYW5jZS1ub3cvbGliL3BlcmZvcm1hbmNlLW5vdy5qcyIsInNjcm9sbEludG9WaWV3LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUF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ICAgIHRyeSB7XG4gICAgICAgIGNhY2hlZFNldFRpbWVvdXQgPSBzZXRUaW1lb3V0O1xuICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgY2FjaGVkU2V0VGltZW91dCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignc2V0VGltZW91dCBpcyBub3QgZGVmaW5lZCcpO1xuICAgICAgICB9XG4gICAgfVxuICAgIHRyeSB7XG4gICAgICAgIGNhY2hlZENsZWFyVGltZW91dCA9IGNsZWFyVGltZW91dDtcbiAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgIGNhY2hlZENsZWFyVGltZW91dCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignY2xlYXJUaW1lb3V0IGlzIG5vdCBkZWZpbmVkJyk7XG4gICAgICAgIH1cbiAgICB9XG59ICgpKVxuZnVuY3Rpb24gcnVuVGltZW91dChmdW4pIHtcbiAgICBpZiAoY2FjaGVkU2V0VGltZW91dCA9PT0gc2V0VGltZW91dCkge1xuICAgICAgICByZXR1cm4gc2V0VGltZW91dChmdW4sIDApO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHJldHVybiBjYWNoZWRTZXRUaW1lb3V0LmNhbGwobnVsbCwgZnVuLCAwKTtcbiAgICB9XG59XG5mdW5jdGlvbiBydW5DbGVhclRpbWVvdXQobWFya2VyKSB7XG4gICAgaWYgKGNhY2hlZENsZWFyVGltZW91dCA9PT0gY2xlYXJUaW1lb3V0KSB7XG4gICAgICAgIGNsZWFyVGltZW91dChtYXJrZXIpO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIGNhY2hlZENsZWFyVGltZW91dC5jYWxsKG51bGwsIG1hcmtlcik7XG4gICAgfVxufVxudmFyIHF1ZXVlID0gW107XG52YXIgZHJhaW5pbmcgPSBmYWxzZTtcbnZhciBjdXJyZW50UXVldWU7XG52YXIgcXVldWVJbmRleCA9IC0xO1xuXG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c1JSd9LFxuICAgICAgICAgICAgICAgICAgICB0YXJnZXQgPSBjcmVsKCdzcGFuJywgeydzdHlsZSc6J3Bvc2l0aW9uOmFic29sdXRlOyB0b3A6NTAlOyd9KVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgICk7XG5cbiAgICBmdW5jdGlvbiBhbGlnbigpe1xuICAgICAgICB0YXJnZXQudGV4dENvbnRlbnQgPSAnc2Nyb2xsaW5nJztcbiAgICAgICAgc2Nyb2xsSW50b1ZpZXcodGFyZ2V0LCB7dGltZTogMTAwMH0sIGZ1bmN0aW9uKHR5cGUpe1xuICAgICAgICAgICAgdGFyZ2V0LnRleHRDb250ZW50ID0gdHlwZTtcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIGFsaWduKCk7XG5cbiAgICB2YXIgYnV0dG9uLFxuICAgICAgICBidXR0b24yO1xuXG4gICAgY3JlbChkb2N1bWVudC5ib2R5LFxuICAgICAgICBidXR0b24gPSBjcmVsKCdidXR0b24nLCB7J3N0eWxlJzoncG9zaXRpb246Zml4ZWQ7IHRvcDogMTBweDsgbGVmdDogMTBweCd9LFxuICAgICAgICAgICAgJ3Njcm9sbCBpbnRvIHZpZXcnXG4gICAgICAgICksXG4gICAgICAgIGJ1dHRvbjIgPSBjcmVsKCdidXR0b24nLCB7J3N0eWxlJzoncG9zaXRpb246Zml4ZWQ7IHRvcDogMTAwcHg7IGxlZnQ6IDEwcHgnfSxcbiAgICAgICAgICAgICdzY3JvbGwgaW50byB2aWV3IHdpdGggY3VzdG9tIGVhc2luZydcbiAgICAgICAgKVxuICAgICk7XG5cbiAgICBmdW5jdGlvbiBlYXNlKCl7XG4gICAgICAgIHRhcmdldC50ZXh0Q29udGVudCA9ICdzY3JvbGxpbmcnO1xuICAgICAgICBzY3JvbGxJbnRvVmlldyh0YXJnZXQsIHtcbiAgICAgICAgICAgIHRpbWU6IDEwMDAsXG4gICAgICAgICAgICBlYXNlOiBmdW5jdGlv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IG9ubHkgb25lIGNoaWxkIHRoYXQgaXMgYSBzdHJpbmdcclxuICAgICAgICBpZigoYXJndW1lbnRzTGVuZ3RoIC0gY2hpbGRJbmRleCkgPT09IDEgJiYgdHlwZW9mIGFyZ3NbY2hpbGRJbmRleF0gPT09ICdzdHJpbmcnICYmIGVsZW1lbnQudGV4dENvbnRlbnQgIT09IHVuZGVmaW5lZCl7XHJcbiAgICAgICAgICAgIGVsZW1lbnQudGV4dENvbnRlbnQgPSBhcmdzW2NoaWxkSW5kZXhdO1xyXG4gICAgICAgIH1lbHNle1xyXG4gICAgICAgICAgICBmb3IoOyBjaGlsZEluZGV4IDwgYXJndW1lbnRzTGVuZ3RoOyArK2NoaWxkSW5kZXgpe1xyXG4gICAgICAgICAgICAgICAgY2hpbGQgPSBhcmdzW2NoaWxkSW5kZXhdO1xyXG5cclxuICAgICAgICAgICAgICAgIGlmKGNoaWxkID09IG51bGwpe1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgIGlmIChpc0FycmF5KGNoaWxkKSkge1xyXG4gICAgICAgICAgICAgICAgICBmb3IgKHZhciBpPTA7IGkgPCBjaGlsZC5sZW5ndGg7ICsraSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGFwcGVuZENoaWxkKGVsZW1lbnQsIGNoaWxkW2ldKTtcclxuICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgYXBwZW5kQ2hpbGQoZWxlbWVudCwgY2hpbGQpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBmb3IodmFyIGtleSBpbiBzZXR0aW5ncyl7XHJcbiAgICAgICAgICAgIGlmKCFhdHRyaWJ1dGVNYXBba2V5XSl7XHJcbiAgICAgICAgICAgICAgICBlbGVtZ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hlY2sgaXQuXG4gICAgICAgICAgICAoc2V0dGluZ3MudmFsaWRUYXJnZXQgPyBzZXR0aW5ncy52YWxpZFRhcmdldChwYXJlbnQsIHBhcmVudHMpIDogdHJ1ZSkgJiZcblxuICAgICAgICAgICAgLy8gRWxzZSBpZiB3aW5kb3dcbiAgICAgICAgICAgIHBhcmVudCA9PT0gd2luZG93IHx8XG5cbiAgICAgICAgICAgIC8vIEVsc2UuLi5cbiAgICAgICAgICAgIChcbiAgICAgICAgICAgICAgICAvLy8gY2hlY2sgaWYgc2Nyb2xsYWJsZVxuICAgICAgICAgICAgICAgIChcbiAgICAgICAgICAgICAgICAgICAgcGFyZW50LnNjcm9sbEhlaWdodCAhPT0gcGFyZW50LmNsaWVudEhlaWdodCB8fFxuICAgICAgICAgICAgICAgICAgICBwYXJlbnQuc2Nyb2xsV2lkdGggIT09IHBhcmVudC5jbGllbnRXaWR0aFxuICAgICAgICAgICAgICAgICkgJiZcblxuICAgICAgICAgICAgICAgIC8vIEFuZCBub3QgaGlkZGVuLlxuICAgICAgICAgICAgICAgIGdldENvbXB1dGVkU3R5bGUocGFyZW50KS5vdmVyZmxvdyAhPT0gJ2hpZGRlbidcbiAgICAgICAgICAgIClcbiAgICAgICAgKXtcbiAgICAgICAgICAgIHBhcmVudHMrKztcbiAgICAgICAgICAgIHRyYW5zaXRpb25TY3JvbGxUbyh0YXJnZXQsIHBhcmVudCwgc2V0dGluZ3MsIGRvbmUpO1xuICAgICAgICB9XG5cbiAgICAgICAgcGFyZW50ID0gcGFyZW50LnBhcmVudEVsZW1lbnQ7XG5cbiAgICAgICAgaWYoIXBhcmVudCl7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZihwYXJlbnQudGFnTmFtZSA9PT0gJ0JPRFknKXtcbiAgICAgICAgICAgIHBhcmVudCA9IHdpbmRvdztcbiAgICAgICAgfVxuICAgIH1cbn07Il19
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2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CAhPT0gdW5kZWZpbmVkKXtcclxuICAgICAgICAgICAgZWxlbWVudC50ZXh0Q29udGVudCA9IGFyZ3NbY2hpbGRJbmRleF07XHJcbiAgICAgICAgfWVsc2V7XHJcbiAgICAgICAgICAgIGZvcig7IGNoaWxkSW5kZXggPCBhcmd1bWVudHNMZW5ndGg7ICsrY2hpbGRJbmRleCl7XHJcbiAgICAgICAgICAgICAgICBjaGlsZCA9IGFyZ3NbY2hpbGRJbmRleF07XHJcblxyXG4gICAgICAgICAgICAgICAgaWYoY2hpbGQgPT0gbnVsbCl7XHJcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XHJcbiAgICAgICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAgICAgaWYgKGlzQXJyYXkoY2hpbGQpKSB7XHJcbiAgICAgICAgICAgICAgICAgIGZvciAodmFyIGk9MDsgaSA8IGNoaWxkLmxlbmd0aDsgKytpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgYXBwZW5kQ2hpbGQoZWxlbWVudCwgY2hpbGRbaV0pO1xyXG4gICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICBhcHBlbmRDaGlsZChlbGVtZW50LCBjaGlsZCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGZvcih2YXIga2V5IGluIHNldHRpbmdzKXtcclxuICAgICAgICAgICAgaWYoIWF0dHJpYnV0ZU1hcFtrZXldKXtcclxuICAgICAgICAgICAgICAgIGVsZW1lbnQuc2V0QXR0cmlidXRlKGtleSwgc2V0dGluZ3Nba2V5XSk7XHJcbiAgICAgICAgICAgIH1lbHNle1xyXG4gICAgICAgICAgICAgICAgdmFyIGF0dHIgPSBjcmVsLmF0dHJNYXBba2V5XTtcclxuICAgICAgICAgICAgICAgIGlmKHR5cGVvZiBhdHRyID09PSAnZnVuY3Rpb24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ICAgICAgICAgIHBhcmVudCA9PT0gd2luZG93IHx8XG5cbiAgICAgICAgICAgIC8vIEVsc2UuLi5cbiAgICAgICAgICAgIChcbiAgICAgICAgICAgICAgICAvLy8gY2hlY2sgaWYgc2Nyb2xsYWJsZVxuICAgICAgICAgICAgICAgIChcbiAgICAgICAgICAgICAgICAgICAgcGFyZW50LnNjcm9sbEhlaWdodCAhPT0gcGFyZW50LmNsaWVudEhlaWdodCB8fFxuICAgICAgICAgICAgICAgICAgICBwYXJlbnQuc2Nyb2xsV2lkdGggIT09IHBhcmVudC5jbGllbnRXaWR0aFxuICAgICAgICAgICAgICAgICkgJiZcblxuICAgICAgICAgICAgICAgIC8vIEFuZCBub3QgaGlkZGVuLlxuICAgICAgICAgICAgICAgIGdldENvbXB1dGVkU3R5bGUocGFyZW50KS5vdmVyZmxvdyAhPT0gJ2hpZGRlbidcbiAgICAgICAgICAgIClcbiAgICAgICAgKXtcbiAgICAgICAgICAgIHBhcmVudHMrKztcbiAgICAgICAgICAgIHRyYW5zaXRpb25TY3JvbGxUbyh0YXJnZXQsIHBhcmVudCwgc2V0dGluZ3MsIGRvbmUpO1xuICAgICAgICB9XG5cbiAgICAgICAgcGFyZW50ID0gcGFyZW50LnBhcmVudEVsZW1lbnQ7XG5cbiAgICAgICAgaWYoIXBhcmVudCl7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZihwYXJlbnQudGFnTmFtZSA9PT0gJ0JPRFknKXtcbiAgICAgICAgICAgIHBhcmVudCA9IHdpbmRvdztcbiAgICAgICAgfVxuICAgIH1cbn07XG4iXX0=
{
"name": "scroll-into-view",
"version": "1.7.4",
"version": "1.7.5",
"description": "",

@@ -5,0 +5,0 @@ "main": "scrollIntoView.js",

@@ -27,8 +27,8 @@ var raf = require('raf'),

if(parent === window){
x = targetPosition.left + window.scrollX - window.innerWidth * leftScalar + Math.min(targetPosition.width, window.innerWidth) * leftScalar;
y = targetPosition.top + window.scrollY - window.innerHeight * topScalar + Math.min(targetPosition.height, window.innerHeight) * topScalar;
x = targetPosition.left + window.pageXOffset - window.innerWidth * leftScalar + Math.min(targetPosition.width, window.innerWidth) * leftScalar;
y = targetPosition.top + window.pageYOffset - window.innerHeight * topScalar + Math.min(targetPosition.height, window.innerHeight) * topScalar;
x = Math.max(Math.min(x, document.body.scrollWidth - window.innerWidth * leftScalar), 0);
y = Math.max(Math.min(y, document.body.scrollHeight- window.innerHeight * topScalar), 0);
differenceX = x - window.scrollX;
differenceY = y - window.scrollY;
differenceX = x - window.pageXOffset;
differenceY = y - window.pageYOffset;
}else{

@@ -178,2 +178,2 @@ parentPosition = parent.getBoundingClientRect();

}
};
};

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc