A
A
Andrew Ghostuhin2014-07-11 06:49:50
JavaScript
Andrew Ghostuhin, 2014-07-11 06:49:50

How to correctly specify a trigger for popover?

Good morning comrades.
Faced with an unknown (sort of like) problem.
Bible BS3 is connected (bootstrap.js = 3.0.3).
There is this code:

.sv-friendship-popover{ 'data-js' => "friend-action-#{user.id}" }
  = link_to 'Я клиент', '#', class: 'link-style-active', 'data-js' => 'remove-friendship'
  .hide{ 'data-js' => 'friendship-popover' }
    Вы действительно хотите перестать числиться клиентом этой компании?
    = link_to 'Уйти из клиентов', remove_friendship_path(user.id), class: 'link-style', remote: true, method: :post
:javascript
  $(document).ready(function () {
    $('[data-js=remove-friendship]').on('click', function (e) {
      e.preventDefault();
    }).popover({
      'html': true,
      'placement': 'bottom',
      'content': $('[data-js=friendship-popover]').html()
    });
  });

The task is simple, set a trigger to close the popover when you click on an external area on the site,
when you try to say:
:javascript
  $(document).ready(function () {
    $('[data-js=remove-friendship]').on('trigger', function (e) {
      e.preventDefault();
    }).popover({
      'html': true,
      'trigger': 'focus',
      'placement': 'bottom',
      'content': $('[data-js=friendship-popover]').html()
    });
  });

He doesn’t care, the console doesn’t alert in any way, throwing a debugger all the time is problematic, any ideas?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Lesnykh, 2014-07-11
@Torin_Asakura

$(selector).on('trigger', ...)

Such a structure does not exist. Smoke the manual better ;) You need to catch the click event.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question