How to use vue-scrollto - 10 common examples

To help you get started, we’ve selected a few vue-scrollto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dpc-sdp / ripple / packages / components / Molecules / Form / index.vue View on Github external
// Run custom submit callback if no error in validation
      if (this.$refs.vfg.errors.length === 0) {
        RplFormEventBus.$emit('loading', true)
        await this.submitHandler()
        if (this.scrollToMessage) {
          VueScrollTo.scrollTo(this.$el, 500, { offset: -150 })
        }
        if (this.clearFormOnSuccess) {
          this.clearForm()
        }
      } else {
        // scroll into view first element with error
        const firstError = this.$refs.vfg.$children.find(child => child.field.model === this.$refs.vfg.errors[0].field.model)
        if (firstError) {
          VueScrollTo.scrollTo(firstError.$el, 500, { offset: -100 })
        }
      }
      RplFormEventBus.$emit('loading', false)
    }
  }
github pymedusa / Medusa / themes-default / slim / src / components / show-header.vue View on Github external
jumpToSeason(season) {
            // Don't jump until an option is selected
            if (season !== 'jump') {
                // Calculate duration
                let duration = (this.seasons.length - season) * 50;
                duration = Math.max(500, Math.min(duration, 2000)); // Limit to (500ms <= duration <= 2000ms)

                // Calculate offset
                let offset = -50; // Navbar
                // Needs extra offset when the sub menu is "fixed".
                offset -= window.matchMedia('(min-width: 1281px)').matches ? 40 : 0;

                const name = `season-${season}`;
                console.debug(`Jumping to #${name} (${duration}ms)`);

                scrollTo(`[name="${name}"]`, duration, {
                    container: 'body',
                    easing: 'ease-in-out',
                    offset
                });

                // Update URL hash
                window.location.hash = name;

                // Reset jump
                this.jumpToSeason = 'jump';
            }
        }
    }
github apache / incubator-echarts-doc / src / components / DocNav.vue View on Github external
scrollToCurrentTreeNode() {
            let node = this.$el.querySelector('.el-tree-node.is-current');
            if (node) {
                let nodeRect = node.getBoundingClientRect();
                let rootRect = this.$el.getBoundingClientRect();
                if (nodeRect.top > rootRect.bottom || nodeRect.bottom < rootRect.top) {   // Not visible
                    VueScrollTo.scrollTo(node, 500, {
                        offset: -20,
                        easing: 'ease-in-out',
                        container: this.$el
                    });
                }
            }
        },
github openupm / openupm / docs / .vuepress / theme / layouts / PackageAdd.vue View on Github external
this.$data.packageInfo = JSON.parse(content);
        let packageName = this.$data.packageInfo.name;
        if (this.$page.frontmatter.packageNames.includes(packageName))
          throw new Error(`Package ${packageName} already exists`);
        if (packageName.includes("@"))
          throw new Error(
            `Package name "${packageName}" includes character '@', that is not accepted by UPM. Please contact package owner to modify it.`
          );
        this.step = SubmitStep.GetYamlFile.value;
        // Guess license id.
        this.guessLicenseId();
        // Generate YAML.
        this.$data.yaml = this.genYaml();
        this.$data.yamlFilename = this.$data.packageInfo.name + ".yml";
      } catch (error) {
        VueScrollTo.scrollTo("#packageFolder", 500, { offset: -80 });
        if (error.message.includes("404"))
          this.$data.form.packageFolder.error = "package.json not found";
        else this.$data.form.packageFolder.error = error.message;
      } finally {
        this.$data.isSubmitting = false;
      }
    }
  }
github DefinitelyTyped / DefinitelyTyped / types / vue-scrollto / vue-scrollto-tests.ts View on Github external
import Vue from "vue";
import * as VueScrollTo from "vue-scrollto";

Vue.use(VueScrollTo);
Vue.use(VueScrollTo, {offset: -100});

VueScrollTo.setDefaults({offset: -100});

class Test extends Vue {
    mounted() {
        this.$scrollTo(this.$el, {offset: -100});
        this.$scrollTo("#id");
        VueScrollTo.scrollTo("#id", {offset: -100});
    }
}
github czytelny / backlog / src / components / board / BoardContent.vue View on Github external
scrollToNewItem (element) {
        const el = document.getElementById(element.id);
        if (el) {
          var options = {
            container: '.items-container',
            easing: 'ease-in',
            offset: -60,
            force: true,
            cancelable: true,
            x: false,
            y: true
          };
          VueScrollTo.scrollTo(el, 500, options);
          el.classList.add('newlyAddedItem');
          setTimeout(() => {
            el.classList.remove('newlyAddedItem');
          }, 2000);
        }
      },
      boardItemsRearanged ({moved}) {
github MyScienceWork / PolarisOS / front / frontend / pages / deposit / Deposit.js View on Github external
run_next_or_previous(f) {
            f();
            VueScrollTo.scrollTo('#deposit-stepper', 500);
            const content = this.fcontent(this.state.sinks.creations.publication);
            BrowserUtils.localSet('saved_deposit', content);
        },
        update_step(info) {
github wangy8961 / flask-vuejs-madblog / front-end / src / router / index.js View on Github external
setTimeout(() => {
        VueScrollTo.scrollTo(to.hash, 200)
      }, 1000)
      position.selector = to.hash
github czytelny / backlog / src / components / board / EmojiPicker.vue View on Github external
scrollToActiveRow () {
        const el = document.querySelector('.emoji-icon.active');
        if (el) {
          var options = {
            container: '.emoji-simplebar-container .simplebar-content',
            easing: 'linear',
            offset: -60,
            force: true,
            cancelable: true,
            x: false,
            y: true
          };
          VueScrollTo.scrollTo(el, 10, options);
        }
      },
      addEmoji ({emoji, emojiName}) {
github ncform / ncform / packages / ncform / src / components / vue-ncform / index.js View on Github external
vm.$nextTick(() => {
            const firstErrorElem = Array.prototype.slice.call(vm.$el.querySelectorAll('.invalid-feedback')).find(elem => elem.style.display !== 'none');
            if (firstErrorElem) {
              VueScrollTo.scrollTo(firstErrorElem, {
                container: config.container,
                duration: config.duration,
                offset: config.offset
              });
            }
          })
        }

vue-scrollto

Adds a directive that listens for click events and scrolls to elements.

MIT
Latest version published 4 years ago

Package Health Score

56 / 100
Full package analysis

Popular vue-scrollto functions