Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8837329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:41:47+00:00 2026-06-14T09:41:47+00:00

I have got a problem with the swipe event and dragging an element. In

  • 0

I have got a problem with the swipe event and dragging an element.

In my application I use swipeleft/-right to navigate between the pages (it works).
In one page there are a lot of dragging elements (drag works).

So the problem is, when an element is dragging horizontal to the right, the swipeleft works after dragstop. It’s the same with dragging to the left, swiperight works.

It makes me confused.

So is it possible to stop or break the swipeleft/-right when I drag an element?

This is the code for swipe (from Stackoverflow thx)

$('div.ui-page').live("swipeleft", function() {
    var nextpage = $(this).next('div[data-role="page"]');
    // swipe using id of next page if exists
    if (nextpage.length > 0) {
        $.mobile.changePage(nextpage, 'slide');
    }
});
$('div.ui-page').live("swiperight", function() {
    var prevpage = $(this).prev('div[data-role="page"]');
    // swipe using id of next page if exists
    if (prevpage.length > 0) {
        $.mobile.changePage(prevpage, 'slide', true);
    }
});

And this is the code for drag

$ (function(){
var numbers = [ 1, 2, 3, 4, 5 ];    
    numbers.sort( function() { return Math.random() - .5 } );
    alert(numbers);

for ( var i=1; i<6; i++ ) {
    $('#'+i).attr( 'src','bilder/'+numbers[i-1]+'.png' ).draggable( {
      cursor: 'move',
      containment: $('#'+i).parent().parent(),
      revert: true,

    });
  } 
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:41:49+00:00Added an answer on June 14, 2026 at 9:41 am

    Ok, now I got the solution:

    o.v.’s answer was correct and with ahren’s tip I’ve solved it.

    To explain here is the code:

    var moveme=false;  // global variable is false(by default) when no element is dragged
    
    $('div.ui-page').live("swipeleft", function (event){
    
    if(moveme===true){event.preventDefault(); return false;}
    
    var nextpage = $(this).next('div[data-role="page"]');
    // swipe using id of next page if exists
    
    if (nextpage.length > 0) {
    $.mobile.changePage(nextpage, 'slide',true);
    }
    });
    
    $('div.ui-page').live("swiperight", function(event){
    
    if(moveme===true){event.preventDefault(); return false;}
    
    var prevpage = $(this).prev('div[data-role="page"]');
    // swipe using id of next page if exists
    
    if ( prevpage.length > 0) {
    $.mobile.changePage(prevpage, 'slide', true);
    }
    });
    

    The draggable-code:

    $ (function(){
    var numbers = [ 1, 2, 3, 4, 5 ];    
        numbers.sort( function() { return Math.random() - .5 } );
        alert(numbers);
    
    for ( var i=1; i<6; i++ ) {
        $('#'+i).attr( 'src','bilder/'+numbers[i-1]+'.png' ).draggable( {
          cursor: 'move',
          containment: $('#'+i).parent().parent(),
          revert: true,
    
    
    
          start: function(){moveme=true;}, //if an element is dragged moveme=true and
                                           //event.preventDefault() is used. So it is not possible to swipe
          stop: function(){moveme=false;}, //after dragging swipe can be used (default)
    
            });
    
      } 
    });
    

    So, thank you very much for your help o.v. and ahren

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a problem with the zend navigation. I use the zend navigation,
I have got a problem. I have windows forms application with dynamic generated layout,
folks! I am a newbie for cc.net tool. And i have got problem.I use
I have got a Problem, I am developing an Application which should be able
I have got a problem with my JSF application. On a page there's a
I have got a problem in FM application. The error is in the code
I have got a problem to get back a parameter from my view to
I have got a problem with calling a global function, which takes a pointer
I have got a strange problem about in_array recently which I cannot understand. e.g.
I have got a performance problem about TextField.htmlText +=msg .And I know that TextField.appendText(msg)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.