-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Problem with Jquery mobile #16
Comments
Same thing here. The other problem I am having is when I go back to a page with the swipe on it, it doesn't reinitialize. Have you figured that out? |
I havent actually tested the swipe event with the swipejs code. I use Android (HTC Desire). I noticed on an iphone and ipad that the swipejs code won't work at all. |
I got this working with jquery mobile yesterday. Can you send me a link to look at what you're doing and perhaps I can help? |
I was able to fix this by adding this to my css, this fix is mentioned elsewhere for fixing flickering when using transforms on safari. Note that this might cause other unwanted behavior, but for me was no problem.
|
Thanks so much! Those 2 lines of CSS have eliminated so many annoying visual quirks. |
After adding the 2 css lines it seems to work fine on Iphone now. Great. But i still can't get it to work with JQM on Android. I have tested it on my Desire and my Sony Tablet S. Have anyone of you got it to work on Android? You can view my testpage and my sourcecode here: http://m.papper.fi/dev/bbswipe/jqm.html |
Hey guys, sorry for not getting back to this earlier. I will be working shortly to test Swipe with JQM. I will put together a post on my blog about how to solve these problems. I will post the link when complete. Thanks for trying out Swipe :). |
I'm not sure this is a good fix or anything, but I figured out a way to get this to work for the time being with jquery mobile. All I did was find "window.addEventListener('resize', this, false);" in swipe.js and add an additional line of "window.addEventListener('load', this, false);" Then further down do the same again by adding "case 'load': this.setup(); break;" below "case 'resize': this.setup(); break;". |
That is a pretty good fix but I think this will be best outside the library and within the Swipe instance that is created on your page. |
I think the problem it's related to the visibility of the list blocks and how jqm manages the creation, enhancement and display events. I've managed to make it work doing the following: Create the swipe objects on pagecreate:
Do the individual setup, (as Zgraham explained) on pageshow
I've tried to hook this on the previous events but it only seems to work when the divs to swipe are actually displayed.
|
Hi Brad. Is Swipe2 going to be more easily compatible with jQuery Mobile? I'd like to help, test or setup a demo if ya need. I agree with not editing the swipe lib in order to make this work, but making a helper func that solves the problem. |
Swipe2 attempts to solve some of these issues. I will let you guys know when I am ready to have you guys test it out in jQM. |
Thanks for all the fixes and suggestions. I got it to load by combining the creation and setup into one pageinit:
But ... I am getting this weird offset issue in all browsers.I'm using swipe v1 and jQM 1.0.1. See screenshot: Does anyone have any brilliant fixes for that or has seen it before? A virtual beverage of your choice PLUS fantastic open source code karma for the one who knows this one! :D Thanks ! |
_OK. All is working fine now, but I had to make some hacks to the CSS._ Here are my changes which fix the strange offset that was occurring - I assume from the jQM framework manipulations (see image link above for reference). Color added for your viewing pleasure so you can see what is doing what where.
Using swipe v1 and jQM 1.0.1 _Brad_ - if you want me to post both versions of it being weird and with that css fix applied, let me know and I'll slap some links on ya. BTW - I am loving swipejs and think it's the bomb. You need to put a donate paypal button on the proj homepage so people like me can buy you a delicious beverage. |
hi Brent, can you share the code of the html file you have used to fix this issue? I am having difficulties in fixing this, tried a lot many things but not working. thanks! |
Yes, I'll share both versions today. |
OK. Here is a sample that you can play with and see what's going on. The default CSS is set to 'swipe'. There you can see the offset problem that jQM is messing with the UL of the slider. Simply change the slider class to 'swipe2' to load the alternate styles which fix the issue. I know it's hackish and could surely be cleaned up a bit, but you'll see the issue. I see the offset problem in Chrome as well as Mobile Safari. Let me know what you think and if you have solved it another way. I know that Brad is working on v2 which may address this as well as the init loading sequence issues. Thanks !!!
|
Ok guys, spent some time working with jQuery Mobile and Swipe2. Looks to be working perfectly: http://fiddle.jshell.net/bradbirdsall/PT5d3/show/ Boom shaka laka :) Feel free to start testing out the Swipe2 branch |
Yep working great now. Thank you Brad. Awesome !!! |
Thanks saski! I've been debugging for hours and hours on this problem finally found this thread lol. Thanks to the setup function on pageshow everything works.. |
This is definately sweet but it's still not working for me as is provided at http://fiddle.jshell.net/bradbirdsall/PT5d3/show/ All of the div's are showing up stacked on top of each other. Not inside 'slider'. |
Hmmm yeah. I think that Brad may have changed some things since this fiddle code. I see what you mean. I appears that it's missing some vital css that hides all the slides first. I would try to integrate his v2 of swipe here: |
Yeah, I've been firebugging it for about two days now and can't seem to get it to work. |
Wow thanks @saski and @Zgraham for your solutions. I was having the same problem, except that the slide is on a second page, so it was even more complicated. <script>
var elem;
$( document ).delegate("#myelement", "pagecreate", function() {
elem = document.getElementById('mySwipe');
});
$( document ).delegate("#myelemen", "pageshow", function() {
window.mySwipe = new Swipe(elem);
});
</script> Thanks guys !! |
Sorry fellas, I changed the API a bit and then changed it back in the process of building Swipe2. The jsFiddle I posted above is back working now with the proper structure. My apoligies |
Is there an example of Slide2 working with JQM and having the navigation links on it working? Struggling a bit to get it working. Thanks guys, great component... |
Thanks parisholley, Its working fine. Instead of * you can assign the style for particular container which is having swipe functionality... great... thank u again... |
I have strange behavior where I have three divs with data-role="page". When I add the CSS I have a blank screen. Swipe doesn't seem to do anything. I am using the lastest JQM and their new feature for a slide out panel. |
I was having problems getting this to work. I'm using jQuery 1.9.1. The solution uses .live() which has now been removed. So new code needs to be something like: $(document).on('pageshow','#home',function(){ |
Hi! I'm working on a mobile html5 app for my company and have found your swipe script the absolute best.
There seems to be one problem though. I'm using Jquery mobile and the swipe function won't work so good. I have noticed the problem may have something to do with the display:block.
For example:
This code won't work, it only shows the first pic and nothing more:
But if i set the other div to display:block also, it will work. But when the page loads that divs "flashes" by. And thats not so pretty.
Like this:
Any ideas of why?
Thank you for your great work.
The text was updated successfully, but these errors were encountered: