2023年6月21日发(作者:)
css加⼊⽇期,根据⽇期或时间的⽇期或时间更改CSS我有⼀个关于加载基于⼀天中的时间或⽇期更改CSS的JavaScript的问题。根据⽇期或时间的⽇期或时间更改CSS问题:如何缓存图像以避免页⾯间的加载?该脚本⼯作正常,并根据⼀天中的时间将该类添加到正⽂和标题中。但是,当⽤户点击⽹站的下⼀页时,它将重新加载相同的CSS类,并使该⽹站在加载CSS之前闪烁为⽩⾊。我已将脚本放置在页⾯底部和标题中。但它仍然在加载脚本的每个页⾯上闪烁。每当⽤户从页⾯转到页⾯时,是否可以防⽌脚本加载?这⾥是Js代码。function TimeOfDaySiteChange() {var d = new Date();var n = rs();if (n < 5) {// midnightnight();} else if (n > 16 && n < 20) {// If time is between 5PM – 8PM sunset theme to 'body'dusk();} else if (n > 19) {// If time is 8PMnight();} else if (n > 8) {// If time is 9AMdaytime();} else {// Else use 'dawn' themedawn();}}function dawn() {jQuery('body').addClass('sunrise_bg');jQuery('#header_masthead').addClass('sunrise_masthead_bg');}function daytime() {jQuery('body').addClass('day_bg');jQuery('#header_masthead').addClass('day_masthead_bg');}function dusk() {jQuery('body').addClass('sunset_bg');jQuery('#header_masthead').addClass('sunset_masthead_bg');}function night() {jQuery('body').addClass('night_bg');jQuery('#header_masthead').addClass('night_masthead_bg');}function init() {TimeOfDaySiteChange();} = init;我也尝试过不+0你有没有试过把你的代码放在⽂档就绪函数中? –2013-04-29 15:00:09+1您不需要向#header_masthead添加类,只需执⾏e_bg #header_masthead {} –2013-04-29 15:01:41+0关于flash;在JS加载之前,运⾏并最终添加⼀个类,浏览器将显⽰默认页⾯。我会在服务器端添加类。 –2013-04-29 15:02:55
2023年6月21日发(作者:)
css加⼊⽇期,根据⽇期或时间的⽇期或时间更改CSS我有⼀个关于加载基于⼀天中的时间或⽇期更改CSS的JavaScript的问题。根据⽇期或时间的⽇期或时间更改CSS问题:如何缓存图像以避免页⾯间的加载?该脚本⼯作正常,并根据⼀天中的时间将该类添加到正⽂和标题中。但是,当⽤户点击⽹站的下⼀页时,它将重新加载相同的CSS类,并使该⽹站在加载CSS之前闪烁为⽩⾊。我已将脚本放置在页⾯底部和标题中。但它仍然在加载脚本的每个页⾯上闪烁。每当⽤户从页⾯转到页⾯时,是否可以防⽌脚本加载?这⾥是Js代码。function TimeOfDaySiteChange() {var d = new Date();var n = rs();if (n < 5) {// midnightnight();} else if (n > 16 && n < 20) {// If time is between 5PM – 8PM sunset theme to 'body'dusk();} else if (n > 19) {// If time is 8PMnight();} else if (n > 8) {// If time is 9AMdaytime();} else {// Else use 'dawn' themedawn();}}function dawn() {jQuery('body').addClass('sunrise_bg');jQuery('#header_masthead').addClass('sunrise_masthead_bg');}function daytime() {jQuery('body').addClass('day_bg');jQuery('#header_masthead').addClass('day_masthead_bg');}function dusk() {jQuery('body').addClass('sunset_bg');jQuery('#header_masthead').addClass('sunset_masthead_bg');}function night() {jQuery('body').addClass('night_bg');jQuery('#header_masthead').addClass('night_masthead_bg');}function init() {TimeOfDaySiteChange();} = init;我也尝试过不+0你有没有试过把你的代码放在⽂档就绪函数中? –2013-04-29 15:00:09+1您不需要向#header_masthead添加类,只需执⾏e_bg #header_masthead {} –2013-04-29 15:01:41+0关于flash;在JS加载之前,运⾏并最终添加⼀个类,浏览器将显⽰默认页⾯。我会在服务器端添加类。 –2013-04-29 15:02:55
发布评论