एएसपीनेट में चलती अधिसूचना प्रदर्शित करना


मैं चाहता हूं कि मेरी वेबसाइट पर सूचनाएं ऊपर से नीचे की ओर प्रदर्शित हों। सूचनाएं डेटाबेस से प्राप्त की जानी चाहिए। क्या आप मुझे कुछ सुझाव दे सकते हैं कि इसे कैसे कार्यान्वित किया जाए।

समाधान 1

क नज़र तो डालो Signalr[^]. इसका उपयोग करके, आप नोटिफिकेशन को सेवर से क्लाइंट तक पुश कर सकते हैं।

समाधान 2

To display moving notifications in an ASP.NET application, you can utilise JavaScript libraries like jQuery or CSS animations. Here's a simple example using jQuery to create a moving notification:

<head runat="server">
    <title> moving notification</title>
   
        <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
        <style>
            .notification {
                position: fixed;
                top: 0;
                left: -100px; /* Start position outside the screen */
                background-color: #333;
                color: #fff;
                padding: 10px;
                transition: left 0.5s ease; /* Animation effect */
            }
        </style>
            <script>
                $(document).ready(function () {
                    // Show the notification initially
                    $('#notification').css('left', '10px');

                    // Move the notification across the screen
                    setTimeout(function () {
                        $('#notification').css('left', 'calc(100% - 220px)'); // Adjust according to your layout
                    }, 4000); // Adjust the delay as needed
                });
            </script>
</head>
<body>
    <form id="form1" runat="server">

   <div id="notification" class="notification">
       
       This is a moving notification</div>
    </form>
</body>
</html>

コメント

タイトルとURLをコピーしました