This is not really a prototype question, but I figured some here might be able to assist.. I am building an image scanner like Apple just added to iPhoto and the new galleries for .mac. For those who haven''t seen it, it lets you scrub through thumbnails of what is in the gallery by dragging your mouse over the preview icon, depending on your position (left to right) over the thumbnail it changes the img.src to a new image. Any how I have this working now, but it is changing the image src on ever mouse move, even if the img doesnnt need to change. For example if my thumb image is 100 px wide, and my list of images to scan only has 4 images, nothing should change until I am 1/4 the way across the thumbnail. So, my quick choice was to compare the current image source to the one I want to change to . If they are the same I do nothing if different I update the image src. var newthumb = "/path/to/image.jpg"; // Actually figured out in other code, this is just here for reference.. var thumb = $(''thumb''); if (thumb.src != newthumb){ thumb.src = newthumb; console.log(thumb.src); } The problem I am having is that thumb.src always equals http:// www.domain.com/path/to/image.jpg even if I just set it to "/path/to/image.jpg"; So my question is how do I compare this properly? ______________________________________________________________________ Alex Duffield ❖ Principal ❖ InControl Solutions . http:// www.incontrolsolutions.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
try Element#readAttribute (http://prototypejs.org/api/element/ readAttribute). Tobie On Oct 4, 11:48 pm, Alex Duffield <A...-GLL9njBnHiGqPKKiFzS5XxZCeNDtXRbv@public.gmane.org> wrote:> This is not really a prototype question, but I figured some here > might be able to assist.. > > I am building an image scanner like Apple just added to iPhoto and > the new galleries for .mac. > > For those who haven''t seen it, it lets you scrub through thumbnails > of what is in the gallery by dragging your mouse over the preview > icon, depending on your position (left to right) over the thumbnail > it changes the img.src to a new image. > > Any how I have this working now, but it is changing the image src on > ever mouse move, even if the img doesnnt need to change. > > For example if my thumb image is 100 px wide, and my list of images > to scan only has 4 images, nothing should change until I am 1/4 the > way across the thumbnail. > > So, my quick choice was to compare the current image source to the > one I want to change to . If they are the same I do nothing if > different I update the image src. > > var newthumb = "/path/to/image.jpg"; // Actually figured out in other > code, this is just here for reference.. > var thumb = $(''thumb''); > > if (thumb.src != newthumb){ > thumb.src = newthumb; > console.log(thumb.src); > > } > > The problem I am having is that thumb.src always equals http://www.domain.com/path/to/image.jpg > even if I just set it to "/path/to/image.jpg"; > > So my question is how do I compare this properly? > > ______________________________________________________________________ > Alex Duffield ❖ Principal ❖ InControl Solutions . http://www.incontrolsolutions.com--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Alex, I think the src attribute returns the fully qualified path to your image, i.e. http://domain.ext/path/to/image.ext On 10/4/07, Alex Duffield <Alex@incontrolsolutions.com> wrote:> > This is not really a prototype question, but I figured some here might be > able to assist.. > > I am building an image scanner like Apple just added to iPhoto and the new > galleries for .mac. > > > For those who haven't seen it, it lets you scrub through thumbnails > of what is in the gallery by dragging your mouse over the preview icon, > depending on your position (left to right) over the thumbnail it changes the > img.src to a new image. > > > Any how I have this working now, but it is changing the image src on ever > mouse move, even if the img doesnnt need to change. > > > For example if my thumb image is 100 px wide, and my list of images to > scan only has 4 images, nothing should change until I am 1/4 the way across > the thumbnail. > > > So, my quick choice was to compare the current image source to the one I > want to change to . If they are the same I do nothing if different I update > the image src. > > > > > var newthumb = "/path/to/image.jpg"; // Actually figured out in other > code, this is just here for reference.. > var thumb = $('thumb'); > > > if (thumb.src != newthumb){ > thumb.src = newthumb; > > console.log(thumb.src); > > } > > > > > The problem I am having is that thumb.src always equals > http://www.domain.com/path/to/image.jpg > even if I just set it to "/path/to/image.jpg"; > > > So my question is how do I compare this properly? > > ______________________________________________________________________ > > *Alex Duffield* *❖* *Principal* *❖* *InControl Solutions* *.* * > http://www.incontrolsolutions.com* <http://www.incontrolsolutions.com/> > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---