[SOLVED] - HOW TO CHANGE POSITION OF TOASTR MESSAGE - FOR ALL PLACES AT A TIME USING JQUERY CUSTOMISATION
WRITE THIS IN YOUR MASTER PAGE JAVASCRIPT
<script type="text/javascript">
function showSuccessToast(Msg) {
$('#toast-container').remove();
toastr["success"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showStickySuccessToast(Msg) {
$('#toast-container').remove();
toastr["success"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showNoticeToast(Msg) {
$('#toast-container').remove();
toastr["info"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showStickyNoticeToast(Msg) {
$('#toast-container').remove();
toastr["info"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showErrorToast(Msg) {
$('#toast-container').remove();
toastr["error"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showStickyErrorToast(Msg) {
$('#toast-container').remove();
toastr["error"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showWarningToast(Msg) {
$('#toast-container').remove();
toastr["error"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showStickyWarningToast(Msg) {
$('#toast-container').remove();
toastr["error"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
// contains old toastr msgs
function unusedstickymessgaes() {
function showSuccessToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showSuccessToast', Msg);
}
function showStickySuccessToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showToast', {
text: Msg,
sticky: true,
position: 'bottom-right',
type: 'success',
closeText: '',
close: function () {
// console.log("toast is closed ...");
}
});
}
function showNoticeToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showNoticeToast', Msg);
}
function showStickyNoticeToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showToast', {
text: Msg,
sticky: true,
position: 'top-right',
type: 'notice',
closeText: '',
close: function () { //console.log("toast is closed ...");
}
});
}
function showWarningToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showWarningToast', Msg);
}
function showStickyWarningToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showToast', {
text: Msg,
stayTime: 10000,
//sticky: true,
sticky: false,
position: 'bottom-right',
type: 'warning',
closeText: '',
close: function () {
// console.log("toast is closed ...");
}
});
}
function showErrorToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showErrorToast', Msg);
}
function showStickyErrorToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showToast', {
text: Msg,
sticky: true,
position: 'top-right',
type: 'error',
closeText: '',
close: function () {
//console.log("toast is closed ...");
}
});
}
}
</script>
________________________________________________________________________________
CHANGE POSITION CLASS AS PER YOUR REQUIREMENT NOW....!
"positionClass": "toast-top-right"
_________________________________________________________________________________
USE NOW WEREVER U NEED!AS BELOW
NOT LIKE THIS ----------->toastr.error(data.Msg);
Keep LIKE THIS--->showSuccessToast(data.Msg);
_________________________________________________________________________________
<script type="text/javascript">
function showSuccessToast(Msg) {
$('#toast-container').remove();
toastr["success"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showStickySuccessToast(Msg) {
$('#toast-container').remove();
toastr["success"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showNoticeToast(Msg) {
$('#toast-container').remove();
toastr["info"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showStickyNoticeToast(Msg) {
$('#toast-container').remove();
toastr["info"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showErrorToast(Msg) {
$('#toast-container').remove();
toastr["error"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showStickyErrorToast(Msg) {
$('#toast-container').remove();
toastr["error"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showWarningToast(Msg) {
$('#toast-container').remove();
toastr["error"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
function showStickyWarningToast(Msg) {
$('#toast-container').remove();
toastr["error"](Msg)
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "0",
"hideDuration": "0",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
//"tapToDismiss" : false
}
}
// contains old toastr msgs
function unusedstickymessgaes() {
function showSuccessToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showSuccessToast', Msg);
}
function showStickySuccessToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showToast', {
text: Msg,
sticky: true,
position: 'bottom-right',
type: 'success',
closeText: '',
close: function () {
// console.log("toast is closed ...");
}
});
}
function showNoticeToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showNoticeToast', Msg);
}
function showStickyNoticeToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showToast', {
text: Msg,
sticky: true,
position: 'top-right',
type: 'notice',
closeText: '',
close: function () { //console.log("toast is closed ...");
}
});
}
function showWarningToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showWarningToast', Msg);
}
function showStickyWarningToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showToast', {
text: Msg,
stayTime: 10000,
//sticky: true,
sticky: false,
position: 'bottom-right',
type: 'warning',
closeText: '',
close: function () {
// console.log("toast is closed ...");
}
});
}
function showErrorToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showErrorToast', Msg);
}
function showStickyErrorToast1(Msg) {
$('.toast-container').remove();
$().toastmessage('showToast', {
text: Msg,
sticky: true,
position: 'top-right',
type: 'error',
closeText: '',
close: function () {
//console.log("toast is closed ...");
}
});
}
}
</script>
________________________________________________________________________________
CHANGE POSITION CLASS AS PER YOUR REQUIREMENT NOW....!
"positionClass": "toast-top-right"
_________________________________________________________________________________
USE NOW WEREVER U NEED!AS BELOW
NOT LIKE THIS ----------->toastr.error(data.Msg);
Keep LIKE THIS--->showSuccessToast(data.Msg);
_________________________________________________________________________________
[SOLVED] - HOW TO CHANGE POSITION OF TOASTR MESSAGE - FOR ALL PLACES AT A TIME USING JQUERY CUSTOMISATION
Reviewed by Rejeti Praveen Kumar
on
05:47
Rating:
No comments: