i have following div in devise => sessions
<div class="widgettitle"> <button type="button" class="close" data-dismiss="alert">×</button> <%= "<div class=\"flash_error\">#{h alert}</div>".html_safe unless alert.blank? %> <%= "<div class=\"flash_notice\">#{h notice}</div>".html_safe unless notice.blank? %> </div>
but close button not working.. can please ...?
hi have appropriate js included?
assuming trying use twitter bootstrap's alert functionality?
!function ($) { "use strict"; // jshint ;_; /* alert class definition * ====================== */ var dismiss = '[data-dismiss="alert"]' , alert = function (el) { $(el).on('click', dismiss, this.close) } alert.prototype.close = function (e) { var $this = $(this) , selector = $this.attr('data-target') , $parent if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip ie7 } $parent = $(selector) e && e.preventdefault() $parent.length || ($parent = $this.hasclass('alert') ? $this : $this.parent()) $parent.trigger(e = $.event('close')) if (e.isdefaultprevented()) return $parent.removeclass('in') function removeelement() { $parent .trigger('closed') .remove() } $.support.transition && $parent.hasclass('fade') ? $parent.on($.support.transition.end, removeelement) : removeelement() } /* alert plugin definition * ======================= */ var old = $.fn.alert $.fn.alert = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('alert') if (!data) $this.data('alert', (data = new alert(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.alert.constructor = alert /* alert no conflict * ================= */ $.fn.alert.noconflict = function () { $.fn.alert = old return } /* alert data-api * ============== */ $(document).on('click.alert.data-api', dismiss, alert.prototype.close) }(window.jquery);
how using twitter bootstrap in application?
have included //= require bootstrap
in application.js file? required preference of using gem bootstrap-sass (relies on gem sass-rails)
Comments
Post a Comment