Vue-slider-component: Slider incorrectly resizes when orientation changes on mobile devices

Created on 31 Aug 2017  路  2Comments  路  Source: NightCatSama/vue-slider-component

See attached screenshots of the example page in portrait and landscape orientations on mobile (ignore overlapping text). The slider component does not resize correctly as can be seen with the incorrect piecewise label gaps.

Issue is reproducible in my own project, as well as on the example page.
Thank you.

portrait

landscape view

Most helpful comment

No problem - I got it working already. Code for anyone interested...

mounted() {
  this.$nextTick(function () {
    // Orientation event for mobile users
    window.addEventListener('orientationchange', this.getOrientationChange);

    // Init
    this.getOrientationChange()
  })
},

methods: {
  getOrientationChange(event) {
    this.$refs.slider.refresh()
  },
},

All 2 comments

Sorry, so long ago to reply.

Now the component will only automatically update the component size when the resize event is triggered.

So in other cases, you need to call the refresh method to manually update.

No problem - I got it working already. Code for anyone interested...

mounted() {
  this.$nextTick(function () {
    // Orientation event for mobile users
    window.addEventListener('orientationchange', this.getOrientationChange);

    // Init
    this.getOrientationChange()
  })
},

methods: {
  getOrientationChange(event) {
    this.$refs.slider.refresh()
  },
},

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericdrobinson picture ericdrobinson  路  4Comments

michaelpelletier picture michaelpelletier  路  8Comments

aashrafu picture aashrafu  路  3Comments

senner007 picture senner007  路  5Comments

bogdan1190 picture bogdan1190  路  5Comments