Julie Carlson
Julie Carlson

Reputation: 91

Jquery Touchwipe

I used resources learned on Stack Overflow to find sample script here: http://www.netcu.de/jquery-touchwipe-iphone-ipad-library.

If I use the following, the swipe function fails on android and the user control arrows won't work on android or a pc (I don't have an iphone to test with):

 <script type="text/javascript">
 $(document).ready(function() {
 $('#imagegallery').cycle({
    fx: 'fade'
 }); 
 $("#imagegallery").touchwipe({
    wipeLeft: function() {
        $("#imagegallery").cycle("next");
    },
    wipeRight: function() {
        $("#imagegallery").cycle("prev");
    }
 });
 });
 </script>

If I use this, then the user control arrows work on a pc and android, but the swipe function still won't work:

<script type="text/javascript">
$(document).ready(function() {
$('#imagegallery').cycle({
    fx: 'fade',
    prev: '#prev',
    next: '#next',
    speed: 300
}); 
$("#imagegallery").touchwipe({
    wipeLeft: function() {
        $("#imagegallery").cycle("next").alert("left");
    }, 
    wipeRight: function() {
        $("#imagegallery").cycle("prev").alert("right");
    }

});
});
var swipeOptions = { 
swipe     : swipe, 
threshold : 75 
} 

</script>

I tried everything I could think of to do my own learning and experimenting, but at this point I could really use a push in the right direction. I am using a test page on my son's website: http://zachmcdonald.net/testgallery.php.

Your thoughts are appreciated! Thanks, Julie

Upvotes: 0

Views: 6828

Answers (1)

Roger Roelofs
Roger Roelofs

Reputation: 187

I found it simpler to do the following

$("#imagegallery").touchwipe({
  wipeLeft: function() {
    $("#imagegallery .Next").click(); // selector for you 'next' btn
  }, 
  wipeRight: function() {
    $("#imagegallery .Previous").click() // selector for your 'prev' btn;
  }
});

Upvotes: 1

Related Questions