Nicolas Cavigneaux
2007-Jan-11 12:58 UTC
Strange behaviour with Scriptaculous v 1.7.0 beta 2
Hello, I''m testing beta of scriptaculous and I''ve got a stange behaviour. I''m using this RJS : page << "$(''content'').morph({width:''308px''}, {duration:0.5});" page.replace_html ''subcontent'', :partial => ''sub'' page.replace_html ''nav_path'', nav_path page.delay(0.5) do page.visual_effect :grow, ''subcontent'' end but grow set the opacity of subcontent to 0 and I can''t undestand why. before RJS call: <div class="right-box" id="subcontent" style="display: none;"></div> after RJS call: <div class="right-box" id="subcontent" style="opacity: 0;">content</div> The div grows, I can see it, then when the growing is over it disappear ... If I use show rather that grow it works like a charm. Any idea ? -- Nicolas Cavigneaux http://www.bounga.org http://www.cavigneaux.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi I tried your code and you are right. The error (I think) comes from prototype not scriptaculous. Grow effect at the end does: effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); In your case and in a lot of case, oldstyle is an object with 5 attributes top,left,width,height and opacity, all set to "". In the last release, the setStyle function has been modified for opacity with a test: if (value == 1) ... // Not your case if (value < 0.00001) value = 0; // But as value is an empty string this test returns true and set the opacity to 0!! This is easy to fix, I let the core team do it. I think it breaks more than Grow effect. A workaround is to set opacity to 1 to your element before starting the effect. Or may be to change in effects.js (not sure of side effects) Element.getInlineOpacity = function(element){ return $(element).style.opacity || ''''; } to Element.getInlineOpacity = function(element){ return $(element).style.opacity || ''1''; } HTH Seb On Jan 11, 1:58 pm, Nicolas Cavigneaux <n...-DRabjd/C3MEdnm+yROfE0A@public.gmane.org> wrote:> Hello, > > I''m testing beta of scriptaculous and I''ve got a stange behaviour. > > I''m using this RJS : > > page << "$(''content'').morph({width:''308px''}, {duration:0.5});" > page.replace_html ''subcontent'', :partial => ''sub'' > page.replace_html ''nav_path'', nav_path > page.delay(0.5) do > page.visual_effect :grow, ''subcontent'' > end > > but grow set the opacity of subcontent to 0 and I can''t undestand why. > > before RJS call: > <div class="right-box" id="subcontent" style="display: none;"></div> > > after RJS call: > <div class="right-box" id="subcontent" style="opacity: 0;">content</div> > > The div grows, I can see it, then when the growing is over it > disappear ... > > If I use show rather that grow it works like a charm. > > Any idea ? > -- > Nicolas Cavigneauxhttp://www.bounga.orghttp://www.cavigneaux.net--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thomas Fuchs
2007-Jan-11 15:13 UTC
Re: Strange behaviour with Scriptaculous v 1.7.0 beta 2
http://dev.rubyonrails.org/changeset/5879 Am 11.01.2007 um 14:53 schrieb seb:> > > Hi > > I tried your code and you are right. > The error (I think) comes from prototype not scriptaculous. > > Grow effect at the end does: > > effect.effects[0].element.undoClipping().undoPositioned().setStyle > (oldStyle); > > In your case and in a lot of case, oldstyle is an object with 5 > attributes top,left,width,height and opacity, all set to "". > In the last release, the setStyle function has been modified for > opacity with a test: > if (value == 1) ... // Not your case > if (value < 0.00001) value = 0; // But as value is an empty string > this > test returns true and set the opacity to 0!! > > This is easy to fix, I let the core team do it. I think it breaks more > than Grow effect. > > A workaround is to set opacity to 1 to your element before starting > the > effect. > > Or may be to change in effects.js (not sure of side effects) > > Element.getInlineOpacity = function(element){ > return $(element).style.opacity || ''''; > } > > to > > Element.getInlineOpacity = function(element){ > return $(element).style.opacity || ''1''; > } > > HTH > > Seb > > > On Jan 11, 1:58 pm, Nicolas Cavigneaux <n...-DRabjd/C3MEdnm+yROfE0A@public.gmane.org> wrote: >> Hello, >> >> I''m testing beta of scriptaculous and I''ve got a stange behaviour. >> >> I''m using this RJS : >> >> page << "$(''content'').morph({width:''308px''}, {duration:0.5});" >> page.replace_html ''subcontent'', :partial => ''sub'' >> page.replace_html ''nav_path'', nav_path >> page.delay(0.5) do >> page.visual_effect :grow, ''subcontent'' >> end >> >> but grow set the opacity of subcontent to 0 and I can''t undestand >> why. >> >> before RJS call: >> <div class="right-box" id="subcontent" style="display: none;"></div> >> >> after RJS call: >> <div class="right-box" id="subcontent" style="opacity: >> 0;">content</div> >> >> The div grows, I can see it, then when the growing is over it >> disappear ... >> >> If I use show rather that grow it works like a charm. >> >> Any idea ? >> -- >> Nicolas Cavigneauxhttp://www.bounga.orghttp://www.cavigneaux.net > > > >-- Thomas Fuchs wollzelle http://www.wollzelle.com questentier on AIM madrobby on irc.freenode.net http://www.fluxiom.com :: online digital asset management http://script.aculo.us :: Web 2.0 JavaScript http://mir.aculo.us :: Where no web developer has gone before --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sébastien Gruhier
2007-Jan-11 17:05 UTC
Re: Strange behaviour with Scriptaculous v 1.7.0 beta 2
Thanks fast! On Jan 11, 2007, at 4:13 PM, Thomas Fuchs wrote:> > http://dev.rubyonrails.org/changeset/5879 > > Am 11.01.2007 um 14:53 schrieb seb: > >> >> >> Hi >> >> I tried your code and you are right. >> The error (I think) comes from prototype not scriptaculous. >> >> Grow effect at the end does: >> >> effect.effects[0].element.undoClipping().undoPositioned().setStyle >> (oldStyle); >> >> In your case and in a lot of case, oldstyle is an object with 5 >> attributes top,left,width,height and opacity, all set to "". >> In the last release, the setStyle function has been modified for >> opacity with a test: >> if (value == 1) ... // Not your case >> if (value < 0.00001) value = 0; // But as value is an empty string >> this >> test returns true and set the opacity to 0!! >> >> This is easy to fix, I let the core team do it. I think it breaks >> more >> than Grow effect. >> >> A workaround is to set opacity to 1 to your element before starting >> the >> effect. >> >> Or may be to change in effects.js (not sure of side effects) >> >> Element.getInlineOpacity = function(element){ >> return $(element).style.opacity || ''''; >> } >> >> to >> >> Element.getInlineOpacity = function(element){ >> return $(element).style.opacity || ''1''; >> } >> >> HTH >> >> Seb >> >> >> On Jan 11, 1:58 pm, Nicolas Cavigneaux <n...-DRabjd/C3MEdnm+yROfE0A@public.gmane.org> wrote: >>> Hello, >>> >>> I''m testing beta of scriptaculous and I''ve got a stange behaviour. >>> >>> I''m using this RJS : >>> >>> page << "$(''content'').morph({width:''308px''}, {duration:0.5});" >>> page.replace_html ''subcontent'', :partial => ''sub'' >>> page.replace_html ''nav_path'', nav_path >>> page.delay(0.5) do >>> page.visual_effect :grow, ''subcontent'' >>> end >>> >>> but grow set the opacity of subcontent to 0 and I can''t undestand >>> why. >>> >>> before RJS call: >>> <div class="right-box" id="subcontent" style="display: none;"></div> >>> >>> after RJS call: >>> <div class="right-box" id="subcontent" style="opacity: >>> 0;">content</div> >>> >>> The div grows, I can see it, then when the growing is over it >>> disappear ... >>> >>> If I use show rather that grow it works like a charm. >>> >>> Any idea ? >>> -- >>> Nicolas Cavigneauxhttp://www.bounga.orghttp://www.cavigneaux.net >> >> >>> > > -- > Thomas Fuchs > wollzelle > > http://www.wollzelle.com > > questentier on AIM > madrobby on irc.freenode.net > > http://www.fluxiom.com :: online digital asset management > http://script.aculo.us :: Web 2.0 JavaScript > http://mir.aculo.us :: Where no web developer has gone before > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---