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 8172943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:57:10+00:00 2026-06-06T21:57:10+00:00

I have a horizontal jquery-ui drag drop list contained in a wrapper in which

  • 0

I have a horizontal jquery-ui drag drop list contained in a wrapper in which elements are added dynamically. (The width of each element is 223px and each time a new element is added, the list width is increased by 223px)

$("#list_wrapper").animate({
width: "+=446"
}, 'slow')
$("#list_items").animate({
width: "+=223"
}, 'slow')

The style for these two elements are:

#list_wrapper{
width:672px;
position:relative;
}

#list_items {
height: 290px;
width: 672px;
position: relative;
padding: 0 0 0 2px;
z-index: 0;
cursor: e-resize;
border-width: 0 2px;
}

Now, to browse through the list, we can either drag the list or I have created navigation button for convenience. The navigation buttons shift the “#list_items” elements 223px right or left each time they are clicked:

$("#btn_next").click(function () {
$("#list_items").animate({
left: "-=223"
}, 100);
});
$("#btn_prev").click(function () {
$("#list_items").animate({
left: "+=223"
}, 100);

To make sure the list doesn’t go out of the view, i have added these properties to .draggable.

$("#list_items").draggable({
axis: "x",
containment: "parent"
});

This makes sure that list remains within the container(“#cart_wrapper”) when dragged BUT when the navigation buttons are used, this method fails. So, is there any css trick that can be applied to keep the list within it’s parent while using navigation buttons?

  • 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-06T21:57:14+00:00Added an answer on June 6, 2026 at 9:57 pm

    I didnt’t test your code, but maybe you could do it like this on the click event:

    • get the current left value, which could have changed through dragging
    • calculate the difference to next/prev 223px (or next by one)
    • animate to this difference (so you make sure, that an element is in focus)
    • on the left edge check that you don’t go below 0
    • on the right edge check that you only hit your 223px * items and don’t go over it

    With your code you can move the element into the infinite, because you don’t check whether an edge is reached. 🙂

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

Sidebar

Related Questions

I have a page which contains a jQuery-UI horizontal slider, created using a little
I have a horizontal list on which I have placed borders on the li
I currently have a drop-line horizontal menu using an unordered list with the following
I have a jquery horizontal scroller the only thing is the whole body moves
I have modified jquery mobile a little so a collapsible with data-type=horizontal converts into
Say you have a horizontal, graphical nav menu where each menu item is variable
Is there a jQuery plugin, or other JS library, for making certain elements have
In Javascript/JQuery I have a need to copy one elements CSS style object to
I have a horizontal navigation menu which I can edit the source of, my
I have a horizontal unordered list of 2 images. Intent is to make the

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.