每次加载更新新的背景图

每次加载更新新的背景图,第1张

概述html结构: <div class="main"></div> js: function saveImg() {   var imglens =10;   if (typeof(Storage) !== "undefined") {   if (localStorage.imgPathcount) {   localStorage.imgPathcount = Number(localStora

HTML结构:

<div html-attribute-value">main"></div>

Js:

function saveimg() {
  var imglens =10;
  if (typeof(Storage) !== "undefined") {
  if (localstorage.imgPathcount) {
  localstorage.imgPathcount = Number(localstorage.imgPathcount) + 1;
  $(".main").CSS("background-image",‘url(img/‘ + localstorage.imgPathcount + ‘.jpg)‘)
  if (localstorage.imgPathcount>imglens) {
  localstorage.imgPathcount =1;
  $(".main").CSS("background-image",‘url(img/‘ + localstorage.imgPathcount + ‘.jpg)‘)
  }
  } else {
  localstorage.imgPathcount = 1;
  $(".main").CSS("background-image",‘url(img/‘ + localstorage.imgPathcount + ‘.jpg)‘)
  }
   
  } else {
   
  }
  }
  saveimg(); 
总结

以上是内存溢出为你收集整理的每次加载新新背景图全部内容,希望文章能够帮你解决每次加载更新新的背景图所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1051333.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存