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

width set to 0 for div 'swipe-wrap' and all the elements div in it #72

Open
vicding opened this issue May 14, 2017 · 6 comments
Open

width set to 0 for div 'swipe-wrap' and all the elements div in it #72

vicding opened this issue May 14, 2017 · 6 comments

Comments

@vicding
Copy link

vicding commented May 14, 2017

Hi,
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

  1. div width set to 0 for both swipe-wrap and all its elements
  2. 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!

@loup-brun
Copy link
Collaborator

Could you please provide a jsbin or something live, it is difficult to understand your problem. What do you mean by an "auto-hiding menu"?

@vicding
Copy link
Author

vicding commented May 15, 2017

Thanks for the prompt reply. herewith the jsbin link to the mobile version which does not work.

This is the PC version of the menu bar with happy customer slider using Swipes
screen shot 2017-05-15 at 07 24 40

In the Mobile version, visitor has to click the link to see the menu bar
screen shot 2017-05-15 at 07 25 30

Menu bar in the mobile version does not show the slides, but only the title
screen shot 2017-05-15 at 07 25 41

In mobile version, the menu bar is hidden by default and only be seen when the menu button is clicked.

@loup-brun
Copy link
Collaborator

loup-brun commented May 17, 2017

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:

showMenu(); // show the menu, the way you implement it
mySwipe.setup(); // now that the menu is shown, setup the slides

With jQuery, it could look like this:

$('#menu').show(function() { // callback function
  mySwipe.setup();
});

@vicding
Copy link
Author

vicding commented May 17, 2017

Thanks for the help. I'll try and revert.

@vicding vicding closed this as completed May 17, 2017
@vicding vicding reopened this May 17, 2017
@augustom87
Copy link

having same issue, did you find any solution?

@augustom87
Copy link

having same issue, did you find any solution?

calling mySwipe.setup({options}) with initial options before showing swipe again worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants