Hi, I would like to apply some JQuery''s effects(fadeIn,fadeOut) in my site while page is loading. So i tried below code.when i clicking normal request,code is working fine <script type="text/javascript"> $(function(){ $(''body'').hide().fadeIn(''fast''); $(''a'').click(function(){ var link = $(this).attr(''href''); $(''body'').fadeOut(''fast'', function(){ window.location.href = link; }); return false; }); }); </script> But i had problem only when i clicking ajax link. So i planned to avoid above effects for ajax request. How to set above effects only for normal request ? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jul 9, 2010, at 6:02 AM, Manivannan Jeganathan wrote:> Hi, > > I would like to apply some JQuery''s effects(fadeIn,fadeOut) in my site > while page is loading. > So i tried below code.when i clicking normal request,code is working > fine > <script type="text/javascript"> > $(function(){ > $(''body'').hide().fadeIn(''fast''); > $(''a'').click(function(){ > var link = $(this).attr(''href''); > $(''body'').fadeOut(''fast'', function(){ > window.location.href = link; > }); > return false; > }); > }); > </script> > > But i had problem only when i clicking ajax link. > So i planned to avoid above effects for ajax request. > > How to set above effects only for normal request ?Ajax links (via link_to_remote) at least in Rails 2.x set an inline onclick handler. So either modify your code above to not override those inline handlers or modify JQuery''s ajax setup to apply your animations to ajax links as well (perhaps in the beforeSend callback). -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
well you have to use link_to_function method see on http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#M002237 its is similar to link_to_remote ajax in ror you also shuold have jrails working in your view <%= link_to_function("Avoid Ajax Call", nil, :id => "more_link") do | page| page.select(''body'').hide page[:details].visual_effect :fadeOut # your smoe other effect end %> -- Tushar http://pragtech.co.in -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.