Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
Old July 11th, 2009, 06:12 PM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
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?
Reply With Quote
  #3 (permalink)  
Old July 11th, 2009, 06:13 PM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
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?
Reply With Quote
  #4 (permalink)  
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
Reply With Quote
  #5 (permalink)  
Old July 11th, 2009, 07:16 PM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
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?
Reply With Quote
  #6 (permalink)  
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.
Reply With Quote
  #7 (permalink)  
Old July 12th, 2009, 03:10 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
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?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:50 AM.


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