# How to set JQuery's effect for normal link

**URL:** <https://www.ruby-forum.com/t/how-to-set-jquerys-effect-for-normal-link/191315>\
**Category:** Rails\
**Created:** [July 9, 2010, 3:02pm UTC](https://www.ruby-forum.com/t/how-to-set-jquerys-effect-for-normal-link/191315 "2010-07-09T15:02:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmanivannancse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@jmanivannancse](https://www.ruby-forum.com/u/jmanivannancse)\
**Post date:** [July 9, 2010, 3:02pm UTC](https://www.ruby-forum.com/t/how-to-set-jquerys-effect-for-normal-link/191315/1 "2010-07-09T15:02:40Z")

</div>

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

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 ?

---

<div class="post-metadata">

**Author:** ![jmanivannancse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@jmanivannancse](https://www.ruby-forum.com/u/jmanivannancse)\
**Post date:** [July 9, 2010, 5:14pm UTC](https://www.ruby-forum.com/t/how-to-set-jquerys-effect-for-normal-link/191315/2 "2010-07-09T17:14:50Z")

</div>

On Jul 9, 2010, at 6:02 AM, Manivannan J. wrote:

> ```
> var link = $(this).attr('href');
> 
> ```
> 
> 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).

---

<div class="post-metadata">

**Author:** ![jmanivannancse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@jmanivannancse](https://www.ruby-forum.com/u/jmanivannancse)\
**Post date:** [July 10, 2010, 9:16am UTC](https://www.ruby-forum.com/t/how-to-set-jquerys-effect-for-normal-link/191315/3 "2010-07-10T09:16:41Z")

</div>

well you have to use link\_to\_function method see on  
[http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#M002237](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

> **[Pragmatic Techsoft - Leading Odoo Service Provider - Pragmatic](https://www.pragtech.co.in/)**
>
> Pragmatic Techsoft Is a Leading Odoo service provider and B2B expert that provides Odoo services, including Odoo ERP implementation, odoo consulting, and Odoo application development
