While not directly related to prototype/s.a.u. I thought this would be the best place to pose this question. I apologize, if it''s off topic. I''m working on an interface where I have a bunch of list items floated to the left in a horizontal fashion. The list is inside a absolutely positioned div, with an overflow set to hidden. At one point in my script I have to remove the first list item, but I don''t want the rest of the list items to collapse to the left. Within my script I have something like: this.ul.removeChild(li[0]); this.ul.style.left = ''100px''; Now assuming the list is positioned relative and each list item is set to 100px wide. This should remove the first li, collapsing the others to the left, then I immediately set the left side of the ul to 100px, so it looks like the first li disappears. The script works on Firefox and Opera if the li''s contain a simple DOM snippet - an image or a piece of text. But it seems to slow down on Firefox if the DOM is more complex. I have an image inside each li and I use Thomas''s reflector script at http://mir.aculo.us/stuff/reflector/reflector.html to put a reflection on each image. The script adds about 10 divs to each li. Once the extra divs are in place, when the element is removed there''s a noticeable ''jump'' between the first element being removed and the list being positioned back in place. I''ve tried different variations on the above script such as using prototype''s Element.remove() and Element.setStyle() to no avail. Interestingly, using firebug''s console.time() functions, I can see that the line to set the style is taking 0ms to complete, but the redraw is obviously slower. Anyone know of any tricks to getting firefox''s positioning a little faster? Sorry, for the long email, Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
If the problem is that when you have complex DOM contained in the li, why wouldn''t you clear all the DOM information THEN removeChild / style.left the UL? People will likely notice part of the step change, but it may not be quite as noticeable. Just a thought. - Ian M9 Corp http://www.m9corp.com Jason Hummel wrote:> While not directly related to prototype/s.a.u. I thought this would be > the best place to pose this question. I apologize, if it''s off topic. > > I''m working on an interface where I have a bunch of list items floated > to the left in a horizontal fashion. The list is inside a absolutely > positioned div, with an overflow set to hidden. > > At one point in my script I have to remove the first list item, but I > don''t want the rest of the list items to collapse to the left. Within > my script I have something like: > > this.ul.removeChild(li[0]); > this.ul.style.left = ''100px''; > > Now assuming the list is positioned relative and each list item is set > to 100px wide. This should remove the first li, collapsing the others > to the left, then I immediately set the left side of the ul to 100px, > so it looks like the first li disappears. > > The script works on Firefox and Opera if the li''s contain a simple DOM > snippet - an image or a piece of text. But it seems to slow down on > Firefox if the DOM is more complex. I have an image inside each li and > I use Thomas''s reflector script at > http://mir.aculo.us/stuff/reflector/reflector.html to put a reflection > on each image. The script adds about 10 divs to each li. Once the > extra divs are in place, when the element is removed there''s a > noticeable ''jump'' between the first element being removed and the list > being positioned back in place. > > I''ve tried different variations on the above script such as using > prototype''s Element.remove() and Element.setStyle() to no avail. > > Interestingly, using firebug''s console.time() functions, I can see > that the line to set the style is taking 0ms to complete, but the > redraw is obviously slower. > > Anyone know of any tricks to getting firefox''s positioning a little faster? > Sorry, for the long email, > Jason--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jason Hummel wrote:> While not directly related to prototype/s.a.u. I thought this would be > the best place to pose this question. I apologize, if it''s off topic. > > I''m working on an interface where I have a bunch of list items floated > to the left in a horizontal fashion. The list is inside a absolutely > positioned div, with an overflow set to hidden. > > At one point in my script I have to remove the first list item, but I > don''t want the rest of the list items to collapse to the left. Within > my script I have something like: > > this.ul.removeChild(li[0]); > this.ul.style.left = ''100px'';Why not just set its visibility property to ''hidden''? The element isn''t removed, but why do you want to do that anyway if you don''t want the document to re-flow? [...]> I use Thomas''s reflector script at > http://mir.aculo.us/stuff/reflector/reflector.html to put a reflection > on each image.That''s a pretty effect, but very wasteful of browser resources. It is vastly more efficient to create the reflected images in an image processing program - and you''ll get much better support from browsers that don''t support opacity settings. -- Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I actually tried this, and it doesn''t seem to matter. I know that''s strange. And it bugs the heck out of me, as to why that would be the case, but if the DOM was complex enough to start out, it doesn''t seem to matter. I tried updating the contents to be empty, and I still got the little skip. Also, I realize the reflector script is pretty wasteful, and I probably will just do the reflections in a image program. The reason I put it in, was because the interface will be maintained by people who might find creating the reflections a bit outside their realm. Also, even if I take out the reflection, it still worries me to know the script has this limit imposed on it. If in the future the contents grow to something more substantial, I could just end up with the same problem again. Thanks for the suggestions. On 1/11/07, Ian <ian-40m7FdE+PqjQT0dZR+AlfA@public.gmane.org> wrote:> > If the problem is that when you have complex DOM contained in the li, > why wouldn''t you clear all the DOM information THEN removeChild / > style.left the UL? People will likely notice part of the step change, > but it may not be quite as noticeable. > > Just a thought. > > - Ian > M9 Corp > http://www.m9corp.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 -~----------~----~----~----~------~----~------~--~---
as stated on http://mir.aculo.us/2006/4/27/like-reflections-try-the- reflector -- it''s more of a plaything than meant for production use... :) best, thomas Am 10.01.2007 um 17:09 schrieb Jason Hummel:> > While not directly related to prototype/s.a.u. I thought this would be > the best place to pose this question. I apologize, if it''s off topic. > > I''m working on an interface where I have a bunch of list items floated > to the left in a horizontal fashion. The list is inside a absolutely > positioned div, with an overflow set to hidden. > > At one point in my script I have to remove the first list item, but I > don''t want the rest of the list items to collapse to the left. Within > my script I have something like: > > this.ul.removeChild(li[0]); > this.ul.style.left = ''100px''; > > Now assuming the list is positioned relative and each list item is set > to 100px wide. This should remove the first li, collapsing the others > to the left, then I immediately set the left side of the ul to 100px, > so it looks like the first li disappears. > > The script works on Firefox and Opera if the li''s contain a simple DOM > snippet - an image or a piece of text. But it seems to slow down on > Firefox if the DOM is more complex. I have an image inside each li and > I use Thomas''s reflector script at > http://mir.aculo.us/stuff/reflector/reflector.html to put a reflection > on each image. The script adds about 10 divs to each li. Once the > extra divs are in place, when the element is removed there''s a > noticeable ''jump'' between the first element being removed and the list > being positioned back in place. > > I''ve tried different variations on the above script such as using > prototype''s Element.remove() and Element.setStyle() to no avail. > > Interestingly, using firebug''s console.time() functions, I can see > that the line to set the style is taking 0ms to complete, but the > redraw is obviously slower. > > Anyone know of any tricks to getting firefox''s positioning a little > faster? > Sorry, for the long email, > Jason > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---