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

  • SEARCH
  • Home
  • 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 8307059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:27:13+00:00 2026-06-08T18:27:13+00:00

I am trying to create the effect of a draggable sliding door using jquery

  • 0

I am trying to create the effect of a draggable sliding door using jquery ui.
HTML is:

<div id ="home-elev-door" class="elev-door-wrap">           
        <div class="elev-door"></div>
</div>

The code I currently have is this:

var elevWrap = $('.elev-door-wrap')

$(function() {
    $( ".elev-door" ).draggable({
        cursor: 'pointer',
        axis: 'x',
        drag : function(event, ui) { ui.position.left = onDragElev(ui.position.left); },
        });
});

function onDragElev(left){
    if ( left > 0 ) { left = 0; }
    else if ( (elevWrap.width()+left) < 27 ) { left = 27-elevWrap.width(); }
    return left;
}

What this basically does is enable me to slide the door to the left and back and sets a 27px limit as to how far it is draggable within the parent div. However, what I want to do is reverse this so that the limit is on the right hand side only. I tried changing all instances of ‘left’ to ‘right’ but this does not seem to work. Instead it drags straight out of the parent div on both sides.

Any help with this would be greatly appreciated. Many thanks in advance.

UPDATE: I have a js fiddle link to help illustrate what I mean. Hopefully it helps.
http://jsfiddle.net/metallikat79/RCGDH/

  • 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-08T18:27:15+00:00Added an answer on June 8, 2026 at 6:27 pm

    Sussed it out. All it took was one line of code for containment and passing an array of coordinates as limitations, ie;

    containment: [0, 0, 200, 0]
    

    Here is a link to my updated working example on JS Fiddle:
    http://jsfiddle.net/metallikat79/RCGDH/2/

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

Sidebar

Related Questions

I'm trying to create a floating effect using this code over a UIImageView: [UIView
I am trying to create a slideToggle effect in JQuery. I have a div
I'm trying to create a simple menu pop-up effect using anchors within a div
I'm trying to create the effect of an image draggable using boundaries. well, i
I am trying to create this effect by using HTML in UIWebView control of
I am trying to create sliding images effect: Online demo link text . The
I am trying to create a ripple effect with Jquery. By having an element
I'm trying to create a door opening 3D effect in CSS but I just
I'm trying to create a custom audio effect by extending from the class android.media.audiofx.AudioEffect
I am trying to create a jQuery fadeIn fadeout effect for my page content

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.