4

I'm trying to create a simple iOS magazine with swiping pages:

<div id="page1"></div>
<div id="page2"></div>

I'd like to avoid jQuery Mobile since I don't need the whole library and my only concern is to swipe the pages.

How can I show/hide a div on swipe?

user4157124
  • 2,809
  • 13
  • 27
  • 42
FLuttenb
  • 163
  • 3
  • 4
  • 12
  • plus i'd like to implement a drag-swipe. So the div should show/hide when you drag it over a specific distance. – FLuttenb Jul 01 '13 at 11:27
  • possible duplicate of [Detect a finger swipe through JavaScript on the iPhone and Android](http://stackoverflow.com/questions/2264072/detect-a-finger-swipe-through-javascript-on-the-iphone-and-android) – Danny Beckett Jul 01 '13 at 11:28
  • yes, something like that. That one has the images loaded already, though. I thought more of an solution where I can load the divs via ajax. – FLuttenb Jul 01 '13 at 11:40
  • So load the `div`s via AJAX first, hide them with CSS, then on swipe, hide the shown `div` and show the next one. – Danny Beckett Jul 01 '13 at 11:41
  • I did that already and it works. My only concern about that method is that it might have performance problems. I'm planing on doing an ipad catalog that has a lot of pages and images. Do you think it will limit the performance if I just lay out all divs (next and under each other), load them via ajax at the start of the app and then just put those into the slider? Would it be better to only load the previous and the next page relative to the current page? – FLuttenb Jul 01 '13 at 14:22

0 Answers0