gpt4 book ai didi

javascript - 如何在 JavaScript 中知道浏览器已最小化

转载 作者:行者123 更新时间:2023-11-28 07:03:02 24 4
gpt4 key购买 nike

您好,我有通知div(divNotify),其中包含一些信息和母版页中的计时器

   Protected Sub Timer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Try
Me.GetNotification_Stats()

ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(String), "Alert", "Show_NotifyDiv();", True)

Catch ex As Exception
Me.lblError.Visible = True
Me.lblError.InnerText = ex.Message
End Try
End Sub

divNotify 将在一定时间间隔内显示。
在这里,我需要当用户最小化浏览器时,他将通过闪烁浏览器并更改浏览器颜色来通知

但首先我如何知道浏览器是否在javasript中最小化这里我使用 jquery 来显示 div 标签

  function Show_NotifyDiv() {              
$("#div_NotificationOuter").show(1000);
$("#div_NotificationOuter").animate({ bottom: '+=30px' }, 4000);
}

最佳答案

通过 JavaScript 不可能查明页面是否最小化,但您可以使用 Visibility API 确定该页面是否对用户可见

目前可在 Chrome、Mozilla 和 IE10 中使用。

关于javascript - 如何在 JavaScript 中知道浏览器已最小化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31940295/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com