width set to 0 for div 'swipe-wrap' and all the elements div in it
See original GitHub issueHi, I am using swipe in the auto-hiding menu, in the mobile version, the menu will only slide out when the menu button is clicked. The swipe module works fine in the pc version, but does not work in the iPad or mobile version. There are 2 issues I can currently observe
- div width set to 0 for both swipe-wrap and all its elements
- the js is not running through the divs. The js file suppose to change the attributes and make the slide ‘run’, but none of the
<div>
was changing.
Here is the html in pc version:
<div class="swipe" id="st-quotes" style="visibility: visible;">
<div class="swipe-wrap" style="width: 570px;">
<div data-index="0" style="width: 190px; left: 0px; transition-duration: 400ms; transform: translate(-190px, 0px) translateZ(0px);">slide1
</div>
<div data-index="1" style="width: 190px; left: -190px; transition-duration: 400ms; transform: translate(0px, 0px) translateZ(0px);">slide2
</div>
<div data-index="2" style="width: 190px; left: -380px; transition-duration: 0ms; transform: translate(190px, 0px) translateZ(0px);">slide3
</div>
</div>
</div>
And this is the html in mobile version:
<div class="swipe" id="st-quotes" style="visibility: visible;">
<div class="swipe-wrap" style="width: 0px;">
<div data-index="0" style="width: 0px; left: 0px; transition-duration: 0ms; transform: translate(0px, 0px) translateZ(0px);">slide1
</div>
<div data-index="1" style="width: 190px; left: 0px; transition-duration: 0ms; transform: translate(0px, 0px) translateZ(0px);">slide2
</div>
<div data-index="2" style="width: 190px; left: 0px; transition-duration: 0ms; transform: translate(0px, 0px) translateZ(0px);">slide3
</div>
</div>
</div>
Thanks for any help and tip in advance!
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
swipe js custom widths - javascript - Stack Overflow
Working with the swipe js for mobile devices, I can't work out how to display two divs instead of one. Live Sample here....
Read more >width | CSS-Tricks
The width property in CSS specifies the width of the element's content area. This "content" area is the portion inside the padding, border, ......
Read more >Javascript – Create a slider with columns using Bootstrap – iTecNote
Is it possible to make a column full width using device width and not container ... .swipe-wrap { overflow: hidden; position: relative; }...
Read more >swipe-js-iso - NPM Package Overview - Socket.dev
<div id="slider" class="swipe"> <div class="swipe-wrap"> <div></div> ... with the percentage (0-1) of the full width that has been swiped.
Read more >Trouble Parsing Image and Price | Chandoo.org Excel Forums
<div class="wine-card__image-wrapper"> <a ... visible;"><div class="swipe-wrap" style="width: 1500px;"><div data-index="0" style="width: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think that Swipe sets the width according to actual space taken up by the slides. On the mobile version, the slides are invisible, and thus take up no actual space (so there’s where the
0px
comes from).One way to deal with this is to trigger the Swipe
setup
method when the menu is shown. In the code, it could look like this for instance:With jQuery, it could look like this:
calling mySwipe.setup({options}) with initial options before showing swipe again worked for me