Walter Lee Davis
2007-Sep-07 13:45 UTC
Smooth Scroll (or maybe just script attachment) problems in IE7/XP
I wrote the following script to add the smooth-scroll behavior to all in-page anchors. (N.B.: I didn''t design the problem page, just wrote the script.) It works in IE6 and all the Mac browsers. IE7 is doing nothing at all, however. Could this have something to do with the fact that when the page loads, the anchors in question are all hidden? Another issue might be that 5 of the anchors are invalid -- I''ve alerted the author to this and he may have fixed them by the time you see this. Can anyone see anything here that might cause the problem? I am using the latest stable Scriptaculous. //page (mouse over the FAQ Menu box on the top right to see the anchors in a list) http://visionsecurity.jp/en/faq.html //script var ua = navigator.userAgent; if((ua.indexOf(''Mac'') > -1) && (ua.indexOf(''MSIE'') > -1)){ if(confirm(''This browser is very broken and unsafe. Please get a different one.'')) location.href=''http://getfirefox.com''; }else{ var smoove = function(evt){ Event.stop(evt); this.onclick = function() {return false;}; var t = this.uri[1]; if($(t)) new Effect.ScrollTo(t, {offset: -24}); } Event.observe(window,''load'',function(){ $$(''a'').each(function(el){ if(el.href && el.href.indexOf(''#'') > -1){ el.uri = el.href.split("#"); el.observe(''click'', smoove.bind(el)); } }); }); } Thanks in advance, Walter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Tobie Langel
2007-Sep-07 13:54 UTC
Re: Smooth Scroll (or maybe just script attachment) problems in IE7/XP
Wrote this a while ago: http://tobielangel.com/2007/3/11/a-fistful-of-dollars On Sep 7, 3:45 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> I wrote the following script to add the smooth-scroll behavior to all > in-page anchors. (N.B.: I didn''t design the problem page, just wrote > the script.) It works in IE6 and all the Mac browsers. IE7 is doing > nothing at all, however. > > Could this have something to do with the fact that when the page > loads, the anchors in question are all hidden? > > Another issue might be that 5 of the anchors are invalid -- I''ve > alerted the author to this and he may have fixed them by the time you > see this. > > Can anyone see anything here that might cause the problem? I am using > the latest stable Scriptaculous. > > //page (mouse over the FAQ Menu box on the top right to see the > anchors in a list) > > http://visionsecurity.jp/en/faq.html > > //script > > var ua = navigator.userAgent; > if((ua.indexOf(''Mac'') > -1) && (ua.indexOf(''MSIE'') > -1)){ > if(confirm(''This browser is very broken and unsafe. Please get a > different one.'')) location.href=''http://getfirefox.com'';}else{ > > var smoove = function(evt){ > Event.stop(evt); > this.onclick = function() {return false;}; > var t = this.uri[1]; > if($(t)) new Effect.ScrollTo(t, {offset: -24}); > } > Event.observe(window,''load'',function(){ > $$(''a'').each(function(el){ > if(el.href && el.href.indexOf(''#'') > -1){ > el.uri = el.href.split("#"); > el.observe(''click'', smoove.bind(el)); > } > }); > }); > > } > > Thanks in advance, > > Walter--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Walter Lee Davis
2007-Sep-07 16:06 UTC
Re: Smooth Scroll (or maybe just script attachment) problems in IE7/XP
Thanks, this looks really good. It doesn''t smooth-scroll in Safari 1.3, probably because Event.stop doesn''t work there. That''s why I had the extra line: this.onclick = function() {return false;}; I''ll give this a try and see if it cleans up the IE7 problem. Walter On Sep 7, 2007, at 9:54 AM, Tobie Langel wrote:> > Wrote this a while ago: > http://tobielangel.com/2007/3/11/a-fistful-of-dollars > > On Sep 7, 3:45 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >> I wrote the following script to add the smooth-scroll behavior to all >> in-page anchors. (N.B.: I didn''t design the problem page, just wrote >>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Walter Lee Davis
2007-Sep-07 16:37 UTC
Re: Smooth Scroll (or maybe just script attachment) problems in IE7/XP
Does your example correspond to a single public release of Scriptaculous, or is this something that will only work with this particular version of prototype.js and effects.js? I am having trouble getting this to work -- Firefox/bug is barfing on the CSS3 selector, and Safari just tells me "undefined" in a not-so-helpful manner. [Exception... "''Parse error in selector: ''[href^=#]:not([href=#])'''' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no] Thanks, Walter On Sep 7, 2007, at 12:06 PM, Walter Lee Davis wrote:> > Thanks, this looks really good. It doesn''t smooth-scroll in Safari 1.3, > probably because Event.stop doesn''t work there. That''s why I had the > extra line: > > this.onclick = function() {return false;}; > > I''ll give this a try and see if it cleans up the IE7 problem. > > Walter > > On Sep 7, 2007, at 9:54 AM, Tobie Langel wrote: > >> >> Wrote this a while ago: >> http://tobielangel.com/2007/3/11/a-fistful-of-dollars >> >> On Sep 7, 3:45 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >>> I wrote the following script to add the smooth-scroll behavior to all >>> in-page anchors. (N.B.: I didn''t design the problem page, just wrote >>> > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Walter Lee Davis
2007-Sep-08 21:47 UTC
Re: Smooth Scroll (or maybe just script attachment) problems in IE7/XP
Bump. On Sep 7, 2007, at 12:37 PM, Walter Lee Davis wrote:> > Does your example correspond to a single public release of > Scriptaculous, or is this something that will only work with this > particular version of prototype.js and effects.js? I am having trouble > getting this to work -- Firefox/bug is barfing on the CSS3 selector, > and Safari just tells me "undefined" in a not-so-helpful manner. > > [Exception... "''Parse error in selector: ''[href^=#]:not([href=#])'''' > when calling method: [nsIDOMEventListener::handleEvent]" nsresult: > "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: > no] > > Thanks, > > Walter > > On Sep 7, 2007, at 12:06 PM, Walter Lee Davis wrote: > >> >> Thanks, this looks really good. It doesn''t smooth-scroll in Safari >> 1.3, >> probably because Event.stop doesn''t work there. That''s why I had the >> extra line: >> >> this.onclick = function() {return false;}; >> >> I''ll give this a try and see if it cleans up the IE7 problem. >> >> Walter >> >> On Sep 7, 2007, at 9:54 AM, Tobie Langel wrote: >> >>> >>> Wrote this a while ago: >>> http://tobielangel.com/2007/3/11/a-fistful-of-dollars >>> >>> On Sep 7, 3:45 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >>>> I wrote the following script to add the smooth-scroll behavior to >>>> all >>>> in-page anchors. (N.B.: I didn''t design the problem page, just wrote >>>> >> >> >>> > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Tobie Langel
2007-Sep-08 22:24 UTC
Re: Smooth Scroll (or maybe just script attachment) problems in IE7/XP
Why don''t you chck the source code to verify this ? try Proto 1.5.1.1 and the related scripty version. Regards Tobie On Sep 8, 11:47 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> Bump. > > On Sep 7, 2007, at 12:37 PM, Walter Lee Davis wrote: > > > > > Does your example correspond to a single public release of > > Scriptaculous, or is this something that will only work with this > > particular version of prototype.js and effects.js? I am having trouble > > getting this to work -- Firefox/bug is barfing on the CSS3 selector, > > and Safari just tells me "undefined" in a not-so-helpful manner. > > > [Exception... "''Parse error in selector: ''[href^=#]:not([href=#])'''' > > when calling method: [nsIDOMEventListener::handleEvent]" nsresult: > > "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: > > no] > > > Thanks, > > > Walter > > > On Sep 7, 2007, at 12:06 PM, Walter Lee Davis wrote: > > >> Thanks, this looks really good. It doesn''t smooth-scroll in Safari > >> 1.3, > >> probably because Event.stop doesn''t work there. That''s why I had the > >> extra line: > > >> this.onclick = function() {return false;}; > > >> I''ll give this a try and see if it cleans up the IE7 problem. > > >> Walter > > >> On Sep 7, 2007, at 9:54 AM, Tobie Langel wrote: > > >>> Wrote this a while ago: > >>>http://tobielangel.com/2007/3/11/a-fistful-of-dollars > > >>> On Sep 7, 3:45 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: > >>>> I wrote the following script to add the smooth-scroll behavior to > >>>> all > >>>> in-page anchors. (N.B.: I didn''t design the problem page, just wrote--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Walter Lee Davis
2007-Sep-08 23:23 UTC
Re: Smooth Scroll (or maybe just script attachment) problems in IE7/XP
Thank you. I did, but did not see something that I thought corresponded to a "stable" release. Hence the question. Walter On Sep 8, 2007, at 6:24 PM, Tobie Langel wrote:> > Why don''t you chck the source code to verify this ? > > try Proto 1.5.1.1 and the related scripty version. > > Regards > > Tobie > > On Sep 8, 11:47 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >> Bump. >> >> On Sep 7, 2007, at 12:37 PM, Walter Lee Davis wrote: >> >> >> >>> Does your example correspond to a single public release of >>> Scriptaculous, or is this something that will only work with this >>> particular version of prototype.js and effects.js? I am having >>> trouble >>> getting this to work -- Firefox/bug is barfing on the CSS3 selector, >>> and Safari just tells me "undefined" in a not-so-helpful manner. >> >>> [Exception... "''Parse error in selector: ''[href^=#]:not([href=#])'''' >>> when calling method: [nsIDOMEventListener::handleEvent]" nsresult: >>> "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" >>> data: >>> no] >> >>> Thanks, >> >>> Walter >> >>> On Sep 7, 2007, at 12:06 PM, Walter Lee Davis wrote: >> >>>> Thanks, this looks really good. It doesn''t smooth-scroll in Safari >>>> 1.3, >>>> probably because Event.stop doesn''t work there. That''s why I had the >>>> extra line: >> >>>> this.onclick = function() {return false;}; >> >>>> I''ll give this a try and see if it cleans up the IE7 problem. >> >>>> Walter >> >>>> On Sep 7, 2007, at 9:54 AM, Tobie Langel wrote: >> >>>>> Wrote this a while ago: >>>>> http://tobielangel.com/2007/3/11/a-fistful-of-dollars >> >>>>> On Sep 7, 3:45 pm, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >>>>>> I wrote the following script to add the smooth-scroll behavior to >>>>>> all >>>>>> in-page anchors. (N.B.: I didn''t design the problem page, just >>>>>> wrote > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---