Hi nauna,
Refer below code.
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
#lblTime {
position: fixed;
color: red;
font-size: 20px;
background: white;
padding: 20px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" />
<asp:UpdatePanel ID="updpaging" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server" Height="100px">
<asp:Button ID="btnshowmore" runat="server" Text="Show More" mousehover="stopTheTimer()" />
<asp:Timer ID="timer" runat="server" Interval="1000" OnTick="Timer1_Tick">
</asp:Timer>
<asp:Label ID="lblTime" runat="server" />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnshowmore" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<script type="text/javascript">
$("body").on("mouseover", "[id*=btnshowmore]", function () {
stopTheTimer();
});
$("body").on("mouseout", "[id*=btnshowmore]", function () {
startTheTimer();
});
$(window).scroll(_.debounce(function () {
stopTheTimer();
}, 150, { 'leading': true, 'trailing': false }));
$(window).scroll(_.debounce(function () {
startTheTimer();
}, 150));
function stopTheTimer() {
$find('<%= timer.ClientID %>')._stopTimer();
}
function startTheTimer() {
$find('<%= timer.ClientID %>')._startTimer();
}
</script>
</form>
</body>
</html>
Code
C#
protected void Timer1_Tick(object sender, EventArgs e)
{
lblTime.Text = DateTime.Now.ToString();
}
VB.Net
Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs)
lblTime.Text = DateTime.Now.ToString()
End Sub
Screenshot