Ruby on Rails Friday, November 10, 2017

> On Nov 10, 2017, at 3:53 PM, Joe Guerra <jguerra@jginfosys.com> wrote:
>
> I'm trying to follow this ...
>
> https://github.com/CWSpear/bootstrap-hover-dropdown
>
> and add hover to my drop down menus.
>
> But, I'm not sure what to do with the javascript in this situation? Do I add it to the application.js manifest or do I add the requirements in the application.html?

Reading the Usage section of the README, it appears that all you need to do is to add this file to your vendor/assets/javascripts folder, add a reference to this script into your application.js manifest, then add the data-hover="dropdown" attribute either in place of data-toggle="dropdown" or alongside it (so both events cause the dropdown to appear).

If you're adding this to your link with the normal Rails view helpers, then you already have

link_to(nil, 'Account', class: 'dropdown-toggle', data: { toggle: 'dropdown' })

Change that to read

link_to(nil, 'Account', class: 'dropdown-toggle', data: { toggle: 'dropdown', hover: 'dropdown' })

and you're done.

Walter

>
> Thanks,
> Joe
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6df61ead-8b0b-4ce7-9981-4aefef7d77b6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/FF06A317-709E-437F-B63A-17CBC4C9E5F6%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment