views:

1291

answers:

8

I want to create a draggable and resizable window in JavaScript for cross browser use, but I want to try and avoid using a framework if I can.

Has anyone got a link or some code that I can use?

A: 

Avoiding a framework altogether will leave you with lots of code and a bunch of tedious browser-testing.

If you would consider a framework I'd suggest jQuery with the jqDnR plugin. I think it will solve your problem or perhaps you could combine the functionality of the jQuery draggables with the jQuery resizables

Markus Olsson
A: 

Why don't you want to use a framework? They will save you a lot of work.

http://www.codinghorror.com/blog/archives/001163.html

Edit:

Not using a framework is an option, but frankly, in order to get a good implementation that is cross-browser compatible you're probably going to have to spend at least a day or two and end up writing several pages of code, all of which is already done for you with a simple call to a framework.

levand
A: 

Sometimes you can't choose your environment or architecture, so you're stuck working within constraints like not being able to use frameworks...

happyappa
+2  A: 

JQuery would be a good way to go. And with the Jquery UI plugins (such as draggable), it's a breeze.. (there's a demo here).

Not using a framework, to keep it 'pure', seems just a waste of time to me. There's good stuff, that will save you tremendous amounts of time, time better spent in making your application even better.

But you can always check out the source to get some 'inspiration', and adapt it without the overhead of the stuff you won't use. It's well done and easy to read, and you often discover some cross-browser hacks you didn't even think about..

edit: oh, if you REALLY don't wan't no framework EVER, just check out their source then.. sure you can use some of it for your application.

Berzemus
A: 

Just trying to avoid large framework downloads to the client for one very small thing, perhaps I am being daft.

I had looked at jQuery but also ExtJS, the documentation and UI 'look' seem far superior and professional in ExtJS ... are there particular reasons for you guys recommending jQuery?

Dan
You can skip the frameworks, but then you have to code it yourself, detect if the user is using IE6 and provide a sync'd iframe shim, etc. etc. There are lots of samples out there, but make sure you get one that handles IE6's select lists.
scunliffe
+2  A: 

JQuery is more focused on a lot of nice utility functions, and makes DOM manipulation a whole lot easier. Basically, I consider it to be Javascript as it should have been. It's a supremely helpful addition to the Javascript language itself.

ExtJS is a suite of GUI components with specific APIs... Use it if you want to easily create components that look like that, otherwise, go with a more flexible framework.

levand
A: 

Thanks for your help everyone

Dan
A: 

I would go the jQuery. It even has a nice theme creator.