I am currently working with two draggable divs and I need to find a way to prevent them from being dragged to the right and down. Here is the CSS and JS code for each draggable div:
#the-sheet {
position: absolute;
margin-left: auto;
margin-right: auto;
border-radius: 25px;
top: 200px;
left: 250px;
right: 250px;
height: 400px;
width: 1000px;
background-color: #FFFAFA;
font-family: 'Open Sans', sans-serif;
border: 1px solid red;
}
#second-sheet {
position: absolute;
margin-left: auto;
margin-right: auto;
left: 250px;
right: 250px;
border-radius: 25px;
top: 650px;
height: 500px;
width: 1000px;
background-color: #FFFAFA;
font-family: 'Open Sans', sans-serif;
border: 1px solid red;
}
and the js:
$('#the-sheet, #second-sheet').draggable( {
appendTo: "body",
scrollSpeed: 600,
snap: false,
});
I am looking for a solution that will allow me to move these divs within limits but restrict dragging them to the right, avoiding expansion beyond the desired width.