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

moveto

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moveto - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

bower.json

15

dist/moveTo.js
/*!
* MoveTo - Simple and lightweight javascript library for smooth scrolling to element.
* Version 1.0.0 (13-03-2017 11:23)
* MoveTo - A lightweight, smooth scrolling javascript library without any dependency.
* Version 1.0.1 (13-03-2017 12:35)
* Licensed under MIT

@@ -21,3 +21,3 @@ * Copyright 2017 Hasan Aydoğdu <hsnaydd@gmail.com>

/**
* outQuart Easing Fonksiyonu
* outQuart Easing Function
* @param {Integer} t - current time

@@ -134,3 +134,3 @@ * @param {Integer} b - start value

/*
* Scroll Animasyon Fonkstionu
* Scroll Animation Function
*/

@@ -196,3 +196,6 @@ var animate = function animate() {

window.moveTo = MoveTo;
module.exports = MoveTo;
if (typeof module !== 'undefined') {
module.exports = MoveTo;
} else {
window.moveTo = MoveTo;
}

6

dist/moveTo.min.js
/*!
* MoveTo - Simple and lightweight javascript library for smooth scrolling to element.
* Version 1.0.0 (13-03-2017 11:23)
* MoveTo - A lightweight, smooth scrolling javascript library without any dependency.
* Version 1.0.1 (13-03-2017 12:35)
* Licensed under MIT

@@ -8,2 +8,2 @@ * Copyright 2017 Hasan Aydoğdu <hsnaydd@gmail.com>

"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),MoveTo=function(){function e(e,t,n,o){return e/=o,e--,-n*(e*e*e*e-1)+t}function t(e){for(var t=0,n=0;e;)t+=parseInt(e.offsetTop,10),n+=parseInt(e.offsetLeft,10),e=e.offsetParent;return{top:t,left:n}}function n(e,t){var n={},o=void 0;for(o in e)e.hasOwnProperty(o)&&(n[o]=e[o]);for(o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);return n}function o(e){var t={},n={tolerance:"tolerance",duration:"duration",ease:"ease-function-name"};return Object.keys(n).forEach(function(o){var r=e.getAttribute("data-"+n[o]);r&&(t[o]=r)}),t}var r={tolerance:0,duration:800,ease:"outQuart"};return function(){function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,a),this.options=n(r,t),this.easeFunctions=n({outQuart:e},o)}return _createClass(a,[{key:"registerTrigger",value:function(e){var t=this;if(e){var r=e.getAttribute("href"),a=r&&document.getElementById(r.substring(1)),i=n(this.options,o(e));e.addEventListener("click",function(e){e.preventDefault(),t.move(a,i)})}}},{key:"move",value:function(e){var o=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){r=n(this.options,r);var a=t(e).top,i=window.pageYOffset;a-=r.tolerance;var u=a-i,s=0,c=0;!function e(){var t=window.pageYOffset;if(0===c||!(c===t||u>0&&c>t||u<0&&c<t)){c=t,s+=20;var n=o.easeFunctions[r.ease](s,i,u,r.duration);window.scroll(0,n),s<r.duration&&setTimeout(e,20)}}()}}},{key:"addEaseFunction",value:function(e,t){this.easeFunctions[e]=t}}]),a}()}();window.moveTo=MoveTo,module.exports=MoveTo;
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),MoveTo=function(){function e(e,t,n,o){return e/=o,e--,-n*(e*e*e*e-1)+t}function t(e){for(var t=0,n=0;e;)t+=parseInt(e.offsetTop,10),n+=parseInt(e.offsetLeft,10),e=e.offsetParent;return{top:t,left:n}}function n(e,t){var n={},o=void 0;for(o in e)e.hasOwnProperty(o)&&(n[o]=e[o]);for(o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);return n}function o(e){var t={},n={tolerance:"tolerance",duration:"duration",ease:"ease-function-name"};return Object.keys(n).forEach(function(o){var r=e.getAttribute("data-"+n[o]);r&&(t[o]=r)}),t}var r={tolerance:0,duration:800,ease:"outQuart"};return function(){function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,a),this.options=n(r,t),this.easeFunctions=n({outQuart:e},o)}return _createClass(a,[{key:"registerTrigger",value:function(e){var t=this;if(e){var r=e.getAttribute("href"),a=r&&document.getElementById(r.substring(1)),i=n(this.options,o(e));e.addEventListener("click",function(e){e.preventDefault(),t.move(a,i)})}}},{key:"move",value:function(e){var o=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){r=n(this.options,r);var a=t(e).top,i=window.pageYOffset;a-=r.tolerance;var u=a-i,s=0,f=0;!function e(){var t=window.pageYOffset;if(0===f||!(f===t||u>0&&f>t||u<0&&f<t)){f=t,s+=20;var n=o.easeFunctions[r.ease](s,i,u,r.duration);window.scroll(0,n),s<r.duration&&setTimeout(e,20)}}()}}},{key:"addEaseFunction",value:function(e,t){this.easeFunctions[e]=t}}]),a}()}();"undefined"!=typeof module?module.exports=MoveTo:window.moveTo=MoveTo;

@@ -25,3 +25,3 @@ 'use strict';

'/*!',
' * MoveTo - Simple and lightweight javascript library for smooth scrolling to element.',
' * MoveTo - A lightweight, smooth scrolling javascript library without any dependency.',
' * Version ' + pkg.version + ' (' + today + ')',

@@ -28,0 +28,0 @@ ' * Licensed under ' + pkg.license,

{
"name": "moveto",
"version": "1.0.0",
"description": "Simple and lightweight javascript library for smooth scrolling to element, It has no dependency.",
"version": "1.0.1",
"description": "A lightweight, smooth scrolling javascript library without any dependency.",
"main": "src/moveTo.js",

@@ -6,0 +6,0 @@ "scripts": {

@@ -12,2 +12,8 @@ # MoveTo

Using Yarn
```sh
yarn add moveTo
```
Using Bower

@@ -61,21 +67,28 @@

```sh
# To install dev dependencies run:
// To install dev dependencies run:
yarn
# or
npm install
// To start the development server run:
# To start the development server run:
gulp serve
// To lint your code run:
# To lint your code run:
gulp scripts:lint
// To make a full new build run:
# To make a full new build run:
gulp build
// To run tests
# To run tests
yarn test tests/**
# or
npm test tests/**

@@ -82,0 +95,0 @@ ```

@@ -14,3 +14,3 @@

/**
* outQuart Easing Fonksiyonu
* outQuart Easing Function
* @param {Integer} t - current time

@@ -127,3 +127,3 @@ * @param {Integer} b - start value

/*
* Scroll Animasyon Fonkstionu
* Scroll Animation Function
*/

@@ -189,3 +189,6 @@ const animate = () => {

window.moveTo = MoveTo;
module.exports = MoveTo;
if (typeof module !== 'undefined') {
module.exports = MoveTo;
} else {
window.moveTo = MoveTo;
}

@@ -35,3 +35,3 @@ /* eslint-disable require-jsdoc */

t.not(inst.options.duration, undefined);
t.not(inst.options.easeFunctionName, undefined);
t.not(inst.options.ease, undefined);
});

@@ -60,2 +60,4 @@

t.not(inst.easeFunctions['test'], undefined);
t.notThrows(() => {

@@ -62,0 +64,0 @@ inst.move(elem, {easeFunctionName: 'test'});

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