Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some android phone, element.$el.offsetWidth return 0 #51

Open
Jarweb opened this issue Jan 13, 2021 · 2 comments
Open

some android phone, element.$el.offsetWidth return 0 #51

Jarweb opened this issue Jan 13, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@Jarweb
Copy link

Jarweb commented Jan 13, 2021

Describe the bug
image
image

function Measure(options, element) {
var $el = element.$el;
console.log('viewsize', element)
console.log('viewsize', element.$el.offsetWidth)
setTimeout(() => {
console.log('viewsize setTimeout', element.$el.offsetWidth)
}, 1000)
var viewSize = options.isHorizontal ? $el.offsetWidth: $el.offsetHeight;
var slideSize = (viewSize - Math.ceil(options.slidesPerView - 1) * options.spaceBetween) / options.slidesPerView;
var boxSize = slideSize + options.spaceBetween;
return {
boxSize: boxSize,
viewSize: viewSize,
slideSize: slideSize
};
}

swiper init in react useLayoutEffect

Expected behavior

Information

  • Tiny-Swiper Version: [e.g. v2.0.0]
  • OS: [e.g. android]
  • Browser: -
  • Reproduce example:-
@joe223 joe223 closed this as completed Jan 13, 2021
@joe223 joe223 reopened this Jan 13, 2021
@joe223 joe223 added the bug Something isn't working label Jan 13, 2021
@joe223
Copy link
Owner

joe223 commented Jan 13, 2021

@Jarweb Hi, Would you mind create a repo or demo to reproduce this issue?

You can use https://stackblitz.com/ , just paste demo link on this comments

@a-kud
Copy link

a-kud commented Sep 13, 2023

@Jarweb Can you confirm this is still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants