0

I'm watching a video for learn asp.net core.I'm trying to use toastr notifications (https://github.com/CodeSeven/toastr) its working fine but the problem is that they only appear at the left bottom. I changed anything about the position, but they will always show at the bottom left.

@if (TempData["success"] != null)
{
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
    <script type="text/javascript">
        toastr.success('@TempData["success"]');
        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"
        }
    </script>
}
@if (TempData["error"] != null)
{
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
    <script type="text/javascript">
        toastr.error('@TempData["error"]');
        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"
        }
    </script>
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - BulkyBookWeb</title>
    <link rel="stylesheet" href="~/css/bootswatchTheme.css" />
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
    <link rel="stlyesheet" href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" />
</head>

i added link to layout.cshtml

its my application this is what i want it to be :) How can I move the notification to the top right?

i changed newestOnTop: true; but it still showing left bottom

Bedirhan
  • 3
  • 2
  • Does this answer your question? [Changing positionclass for toastr Notification](https://stackoverflow.com/questions/17273355/changing-positionclass-for-toastr-notification) – Murat Seker Jul 06 '23 at 12:58

1 Answers1

0

I find the reason, a spelling mistake in rel="stlyesheet":

 <link rel="stlyesheet" href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" />

Change it to

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" />

result:

enter image description here

Qing Guo
  • 6,041
  • 1
  • 2
  • 10
  • thank u so much.. i changed stlye to style and its done. I've been searching for a few days where is the error. – Bedirhan Jul 09 '23 at 04:31