Add new features to javascript flash message
This commit is contained in:
parent
6fc1b94856
commit
70a076c059
2 changed files with 23 additions and 6 deletions
|
@ -1,12 +1,19 @@
|
|||
class @Flash
|
||||
constructor: (message, type)->
|
||||
flash = $(".flash-container")
|
||||
flash.html("")
|
||||
@flash = $(".flash-container")
|
||||
@flash.html("")
|
||||
|
||||
$('<div/>',
|
||||
innerDiv = $('<div/>',
|
||||
class: "flash-#{type}",
|
||||
text: message
|
||||
).appendTo(".flash-container")
|
||||
)
|
||||
innerDiv.appendTo(".flash-container")
|
||||
|
||||
flash.click -> $(@).fadeOut()
|
||||
flash.show()
|
||||
@flash.click -> $(@).fadeOut()
|
||||
@flash.show()
|
||||
|
||||
pinToTop: ->
|
||||
@flash.addClass('flash-pinned')
|
||||
|
||||
raise: ->
|
||||
@flash.addClass('flash-raised')
|
||||
|
|
|
@ -15,3 +15,13 @@
|
|||
@extend .alert-danger;
|
||||
}
|
||||
}
|
||||
|
||||
.flash-pinned {
|
||||
position: fixed;
|
||||
top: 80px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.flash-raised {
|
||||
z-index: 1000;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue