How to set jQuery draggable min max-left and min max-right

0 votes

I made a copy of JSbin for practice, JSbin link here, actual site link here.

This is just a practice for making the front-end of websites as I just started learning web dev little over a week ago. You can put in html, css and javascript in the editboxes, and a page spit out in Output just like the actual JSbin.

But the problem is that you can resize the divs pass other divs.

My idea to prevent this from happening is:
1. get the editboxes' current positions
2. store the left/right position of the editbox if resized to 10% window width
3. set the min/max left and right for the draggable div

And hence the question. How do I set the max-left/right for the draggable.

Also, any idea on why the draggable before Output div is diificult to drag to the right.

Edit: How the site is structured. When you drag the .drag (.resize in my JSbin code), it changes its left and right div's left and right. And the draggables are contained in the #main's div.

<div id="main>
  <div id="HTML"></div>
                
  <div class="drag"></div> //drag this left and right to change the right of the HTML and left of CSS
                     
  <div id="CSS"></div>
               
  <div class="drag"></div> //drag this left and right to change the right of the Css and left of JavaScript
                     
  <div id="JavaScript"></div>
                      
  <div class="drag"></div> //drag this left and right to change the right of the JavaScript and left of Output
                     
  <div id="Output"></div>
</div>

 

Jul 20 in Web Development by gaurav
• 17,000 points
5 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Web Development

0 votes
1 answer

html5 video with jquery and inview - how to point to the right video element?

You can make use of this. For more ...READ MORE

answered 3 days ago in Web Development by rajatha
• 7,040 points
8 views
0 votes
1 answer

How to set up authentication for reactjs and django ?

Hello  yahya , Using both, you can secure ...READ MORE

answered Jun 2, 2020 in Web Development by Niroj
• 82,740 points
930 views
0 votes
1 answer

how to add erroricon and custom validation message using jquery?

By default, the error message is put ...READ MORE

answered Jun 30 in Web Development by rajatha
• 7,040 points
52 views
0 votes
0 answers

How to preselect and disable specific checkboxes using js/jquery?

I have checkboxes with randomly generated ids ...READ MORE

Jul 26 in Web Development by gaurav
• 17,000 points
7 views
0 votes
0 answers

how to spin and stop wheel has custom position with jquery

this i my code. I am using this ...READ MORE

Jul 27 in Web Development by gaurav
• 17,000 points
5 views
0 votes
0 answers

jquery-ui and webpack, how to manage it into module?

any idea how to deal with that ...READ MORE

Jul 28 in Web Development by gaurav
• 17,000 points
6 views
0 votes
0 answers

How to set jQuery draggable min/max-left and min/max-right

I made a copy of JSbin for ...READ MORE

Jul 21 in Web Development by gaurav
• 17,000 points
9 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,500 points
305 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools

Hello, Use the following script tag in your ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,740 points
8,778 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,740 points
15,752 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP