Wrox Programmer Forums
|
BOOK: Beginning JavaScript and CSS Development with jQuery
This is the forum to discuss the Wrox book Beginning JavaScript and CSS Development with jQuery by Richard York; ISBN: 9780470227794
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript and CSS Development with jQuery section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 11th, 2009, 05:57 PM
Registered User
 
Join Date: Jul 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Drag and drop

Hello,

I just bought this book, and I must say it is extremely helpful to me. Thank you for writing such a great book!

I just have a question - I know about all the drag and drop functionalities given to me by jQuery, but I need to have a way to create a drop area that can recognize text, images, or text and images that are not explicitly declared as a draggable. For example, I just want to highlight random text on a site whose code I have no control over, like say Yahoo.com, and drag it using browser dragging functionalities, and drop it into a box that I create, all while being able to access what was dropped, etc.

How can I do this? Any help would be greatly appreciated.

Thank you,
David
 
Old July 11th, 2009, 06:12 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Someone correct me if I'm wrong but I don't believe that this is possible I'm afraid.

Firstly cross window drag and drop is only supported in certain browsers (i.e. Safari).

Secondly, for JQuery drag something it has to have the draggable method called on it - you're only going to be able to do this on pages you control and can load Jquery on I'm afraid (i.e. yahoo.com is a no go). There might be a use the select event to trigger the calling of the draggable method on whatever was selected, but I doubt it would be fool proof.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old July 11th, 2009, 06:13 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Further note: It sounds like what you are trying to do is more like an extension (or a web accelerator in IE). You might be better investigating that avenue.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old July 11th, 2009, 06:43 PM
Registered User
 
Join Date: Jul 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Sam,

Thank you for the response. I hope I didn't confuse you - I don't want to do any cross browser drag-and-drop. I'm going to be creating a bookmarklet that will create a droppable area on the page on which users can drop text, images, or text and images into. I also know of a way to load jQuery pages I do not control.

Is there any way to do this kind of drag-and-drop?

Regards,
David
 
Old July 11th, 2009, 07:16 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

There probably is yes. Images should be relatively simple, but text would be much harder, and as I said you would have to try to hook the select event up on every text element (or the body) and then try to work out what had been selected. I'm not sure if this is possible, at least not in a cross-browser compatible way.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old July 11th, 2009, 08:45 PM
Registered User
 
Join Date: Jul 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How can I hook up a select event on every text element? I had assumed the select event only worked on text in input elements.
 
Old July 12th, 2009, 03:10 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Ah yes, good point. In that case I don't know what you might do I'm afraid.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Drag and Drop batott ASP.NET 2.0 Professional 3 April 26th, 2008 07:59 PM
Drag and drop vpinhao Beginning VB 6 0 September 11th, 2006 01:33 PM
Drag/Drop bmains Javascript 1 September 22nd, 2004 07:29 PM
Drag and drop Clive Astley Access 2 August 15th, 2003 12:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.