ifad / data-confirm-modal

Makes Rails' link_to confirm: 'foo' build a Bootstrap Modal instead of calling the browser's confirm() API.
MIT License
270 stars 115 forks source link

Modal isn't on top of everything #19

Closed jordigg closed 9 years ago

jordigg commented 9 years ago

The current js checks if there is any other elements with class ".modal.in" and sets the z-index to be on top of this one but if there are other elements with higher z-indexes it remains on "z-index:1".

That's the function. I would remove it and leave it using a high z-index set via CSS or check all elements and setup the z-index to be on top of all of them or at set the "highest" value to something bigger.

// Make sure it's always the top zindex
    var highest = current = 0;
    $('.modal.in').not('#'+id).each(function() {
      current = parseInt($(this).css('z-index'), 10);
      if(current > highest) {
        highest = current
      }
    });
    modal.css('z-index', parseInt(highest) + 1);
vjt commented 9 years ago

Fixed in #20