简体   繁体   中英

Rails 3 UJS - on hover, not on click

For my show action, I render show.js.erb. This happens when I click a link_to set up with a :remote => true option. How can I set it up so this is triggered on hover?

Create a link with an attribute that won't trigger the Rails-UJS driver:

<%= link_to 'mouse over me!', '#', :'data-remote-on-hover' => true %>

and then wireup your own event:

$('a[data-remote-on-hover]').hover(function() {
  // do something
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM