diff --git a/.gitignore b/.gitignore index c59c35a..ada64ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -*.iml -/target/ -/.idea/ -*.iws -*.ipr \ No newline at end of file +/.project +/.buildpath +/.settings +/.git diff --git a/src/main/javascript/jquery.toastmessage.js b/src/main/javascript/jquery.toastmessage.js index 9317dd7..45e6227 100644 --- a/src/main/javascript/jquery.toastmessage.js +++ b/src/main/javascript/jquery.toastmessage.js @@ -83,9 +83,21 @@ // declare variables var toastWrapAll, toastItemOuter, toastItemInner, toastItemClose, toastItemImage; + var dashPos = localSettings.position.indexOf("-"); + var statusPosName = localSettings.position.substring(0,dashPos); + toastWrapAll = (!$('.toast-container').length) ? $('
').addClass('toast-container').addClass('toast-position-' + localSettings.position).appendTo('body') : $('.toast-container'); toastItemOuter = $('').addClass('toast-item-wrapper'); - toastItemInner = $('').hide().addClass('toast-item toast-type-' + localSettings.type).appendTo(toastWrapAll).html($('').append (localSettings.text)).animate(localSettings.inEffect, localSettings.inEffectDuration).wrap(toastItemOuter); + + //if position is bottom, then prepend + if (statusPosName == 'bottom') { + toastItemInner = $('
').hide().addClass('toast-item toast-type-' + localSettings.type).prependTo(toastWrapAll).html($('').append (localSettings.text)).animate(localSettings.inEffect, localSettings.inEffectDuration).wrap(toastItemOuter); + } else { + + //if position is not bottom - (middle OR top), then append message + toastItemInner = $('
').hide().addClass('toast-item toast-type-' + localSettings.type).appendTo(toastWrapAll).html($('').append (localSettings.text)).animate(localSettings.inEffect, localSettings.inEffectDuration).wrap(toastItemOuter); + } + toastItemClose = $('
').addClass('toast-item-close').prependTo(toastItemInner).html(localSettings.closeText).click(function() { $().toastmessage('removeToast',toastItemInner, localSettings) }); toastItemImage = $('').addClass('toast-item-image').addClass('toast-item-image-' + localSettings.type).prependTo(toastItemInner); diff --git a/src/main/resources/css/jquery.toastmessage.css b/src/main/resources/css/jquery.toastmessage.css index a68683f..66f17c2 100644 --- a/src/main/resources/css/jquery.toastmessage.css +++ b/src/main/resources/css/jquery.toastmessage.css @@ -140,3 +140,22 @@ margin-top: -40px; top: 50%; } + +.toast-position-bottom-left { + position: fixed; + left: 20px; + bottom: 20px; +} + +.toast-position-bottom-center { + position: fixed; + bottom: 20px; + left: 50%; + margin-left: -140px; +} + +.toast-position-bottom-right { + position: fixed; + bottom: 20px; + right: 20px; +} \ No newline at end of file