H5页面,上下滑动翻页(整页翻书切换效果)

news2024/11/18 9:27:09

使用 H5页面,上下滑动翻页 修改

页面间的切换:整页翻书的切换效果

demo代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=750, user-scalable=no">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-title" content="">
<title>整页翻书效果切换-支持PC、移动端上下滑动翻页</title>
<style>
*{ margin:0px; padding:0px; box-sizing:border-box; -webkit-tap-highlight-color:rgba(0,0,0,0);}
html{ max-width:750px; margin:0 auto;}
body{ font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei"; font-size:28px; line-height:1.6; color:#212121;
    -webkit-user-select:none; user-select:none;
    -webkit-touch-callout:none; touch-callout:none;
}
html , body{ width:100%; height:100%; position:relative; overflow:hidden;}
 
/***************************/
.page_box{ width:100%; height:100%; position:relative; overflow:hidden;
  perspective: 800px;
}
.page_box::before{ /* content: ""; */ width: 50px; height:100%; /* z-index: 1; */ position: absolute; left: 0; top:0;
  background-image: -webkit-linear-gradient(180deg , rgb(254,254,254) , rgb(250,250,250) , rgb(242,242,242) , rgb(221,221,221) , rgb(235,235,235) , rgb(245,244,247) , rgb(238,240,242));
}
.page{ width:calc(100% - 40px); height:calc(100% - 50px); position:absolute; left:25px; top:25px; overflow:hidden;
   display:flex; flex-direction: column; justify-content:center; align-items:center;
   box-shadow: 0 0 10px 0 rgba(0,0,0,.3);
   transform-origin: left;
   transform: rotateY(-2deg);
}
.page_body.hide{ display:none;}
 
.page.inTop{
  -webkit-animation:ShowTop .8s ease-out both;
          animation:ShowTop .8s ease-out both;
}
.page.outTop{
  z-index:1;
  -webkit-animation:HideTop 1.5s ease-out both;
          animation:HideTop 1.5s ease-out both;
}
.page.inDown{
  -webkit-animation:ShowDown .8s ease-out both;
          animation:ShowDown .8s ease-out both;
}
.page.outDown{
  z-index:1;
  -webkit-animation:HideDown 1.5s ease-out both;
          animation:HideDown 1.5s ease-out both;
}
@-webkit-keyframes ShowTop{
  0%{ -webkit-transform:rotateY(3deg);}
  100%{ -webkit-transform:rotateY(-2deg);}
}
@keyframes ShowTop{
  0%{ transform:rotateY(3deg);}
  100%{ transform:rotateY(-2deg);}
}
@-webkit-keyframes HideTop{
  0%{ -webkit-transform:rotateY(-2deg);}
  100%{ -webkit-transform:rotateY(-130deg);}
}
@keyframes HideTop{
  0%{ transform:rotateY(-2deg);}
  100%{ transform:rotateY(-130deg);}
}
@-webkit-keyframes ShowDown{
  0%{ -webkit-transform:rotateY(3deg);}
  100%{ -webkit-transform:rotateY(-2deg);}
}
@keyframes ShowDown{
  0%{ transform:rotateY(3deg);}
  100%{ transform:rotateY(-2deg);}
}
@-webkit-keyframes HideDown{
  0%{ -webkit-transform:rotateY(-2deg);}
  100%{ -webkit-transform:rotateY(-130deg);}
}
@keyframes HideDown{
  0%{ transform:rotateY(-2deg);}
  100%{ transform:rotateY(-130deg);}
}
 
.arrow{ width:60px; height:52px; color: #f00; font-size: 36px; position:absolute; left:50%; margin-left: -30px; bottom:0;
  -webkit-animation:fadeIn .5s 1s ease-in-out both;
          animation:fadeIn .5s 1s ease-in-out both;
}
.arrow.hide{ display:none;}
.arrow div:first-child , .arrow div:last-child{ display: flex; justify-content: center; align-items: center; width:60px; height: 40px; position:absolute; left:0;
  -webkit-transform-origin:center top;
          transform-origin:center top;
}
.arrow div:first-child{ top:0;
  -webkit-animation:arrow .8s .5s ease-in-out infinite alternate;
          animation:arrow .8s .5s ease-in-out infinite alternate;
}
.arrow div:last-child{ top:12px;
  -webkit-animation:arrow .8s .8s ease-in-out infinite alternate;
          animation:arrow .8s .8s ease-in-out infinite alternate;
}
@-webkit-keyframes arrow{
  100%{ -webkit-transform:translateY(-50%); opacity:1;}
  0%{ -webkit-transform:translateY(0); opacity:0;}
}
@keyframes arrow{
  100%{ transform:translateY(-50%); opacity:1;}
  0%{ transform:translateY(0); opacity:0;}
}
/***************************/
 
@-webkit-keyframes fadeInMinToMax{
  0%{ -webkit-transform:scale(0); opacity:0;}
  100%{ -webkit-transform:scale(1); opacity:1;}
}
@keyframes fadeInMinToMax{
  0%{ transform:scale(0); opacity:0;}
  100%{ transform:scale(1); opacity:1;}
}
.page{ font-size: 40px; background:url(data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAkAn8DAREAAhEBAxEB/8QAGwABAQEBAQEBAQAAAAAAAAAAAAUGBAMCAQn/xAAdAQEAAwEBAQEBAQAAAAAAAAAABAUGBwMBAggJ/9oADAMBAAIQAxAAAAH+gH+J/wDWgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA97WJsOoZvEca14At7ij9ZDP8/vABs+u5TL8/vOSingelhF2fWM1iOL68AV9pTdtr4Zvm2gAGw65lc1hLvkz08D7leO06/lsRxbXgAAPVu+0ZDCcX17yAU9TV2dTXZPlulAGr6bmo+cspmVswBu+25DCcb1SN6gUNNWW9fW5TlWlAGo6Tnp9NJj4+4AG37RkcXyfSecSTU0tbMytmAPe4ien35yU0wAU9JWS6ab+xPYAV9fVyMhaAD3s4npJ8+SjngChpqydSTf2J7ACprqyXkbMAAAV9dUSMjbgD0nxeuy8eDPWAA69DA5630+IEsAWNdTx8jcAD0lReu78uDNTwB2X0DyienhWSwBT19XMyFoAKmprKmkhZfmWgAGr6jmo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7yYudY+zixFU7x9nLcQcv7iN01QKOCC93eMbquXSSp1cybol7mlaIZ1sJ2En1uKRWLFgFjkBT1F0jrAREOtBCjDIBEKJTV3XwoX1dOQENVZOONAKR1F3q8gdbgykEAEUQEdIiOVXJ2dCYjIbrLVgBHCpAU9R+eoCBiIRN0OjBH4ZJVYg1iYuolWpvTLlbAQQe3U40ZmGIzOzo4kzDbhLEHk3S8RxGB9hBggahRPIujheEphJFXf//Z) repeat-y; background-size:100%;}
.page1_title{ width:80%; height:100px; line-height:100px; margin: 0 auto; text-align: center; font-size: 50px;
  -webkit-animation:fadeInMinToMax .8s .4s ease-out both;
          animation:fadeInMinToMax .8s .4s ease-out both;
}
.page1 .scroll_box{ width:80%; height:60vh; margin: 0 auto; overflow-y:auto; -webkit-overflow-scrolling:touch;
  -webkit-animation:fadeInMinToMax 1.5s .4s ease-out both;
          animation:fadeInMinToMax 1.5s .4s ease-out both;
}
.page2 .scroll_box{ width: 100%; height: 100%; text-align: center; overflow-y: auto; -webkit-overflow-scrolling: touch;}
.page2 .scroll_box > div{ padding: 50px 0 80px 0;}
.page2_body div:nth-child(1) , .page3_body div:nth-child(1){
  -webkit-animation:fadeInMinToMax .8s .4s ease-out both;
          animation:fadeInMinToMax .8s .4s ease-out both;
}
.page2_body div:nth-child(2) , .page3_body div:nth-child(2){
  -webkit-animation:fadeInMinToMax .8s .5s ease-out both;
          animation:fadeInMinToMax .8s .5s ease-out both;
}
.page2_body div:nth-child(3) , .page3_body div:nth-child(3){
  -webkit-animation:fadeInMinToMax .8s .6s ease-out both;
          animation:fadeInMinToMax .8s .6s ease-out both;
}
.page2_body div:nth-child(4) , .page3_body div:nth-child(4){
  -webkit-animation:fadeInMinToMax .8s .7s ease-out both;
          animation:fadeInMinToMax .8s .7s ease-out both;
}
.page2_body div:nth-child(5) , .page3_body div:nth-child(5){
  -webkit-animation:fadeInMinToMax .8s .8s ease-out both;
          animation:fadeInMinToMax .8s .8s ease-out both;
}
.page2_body div:nth-child(6) , .page3_body div:nth-child(6){
  -webkit-animation:fadeInMinToMax .8s .9s ease-out both;
          animation:fadeInMinToMax .8s .9s ease-out both;
}
.page2_body div:nth-child(7) , .page3_body div:nth-child(7){
  -webkit-animation:fadeInMinToMax .8s 1s ease-out both;
          animation:fadeInMinToMax .8s 1s ease-out both;
}
.page2_body div:nth-child(8) , .page3_body div:nth-child(8){
  -webkit-animation:fadeInMinToMax .8s 1.1s ease-out both;
          animation:fadeInMinToMax .8s 1.1s ease-out both;
}
.page2_body div:nth-child(9) , .page3_body div:nth-child(9){
  -webkit-animation:fadeInMinToMax .8s 1.2s ease-out both;
          animation:fadeInMinToMax .8s 1.2s ease-out both;
}
.page2_body div:nth-child(10) , .page3_body div:nth-child(10){
  -webkit-animation:fadeInMinToMax .8s 1.3s ease-out both;
          animation:fadeInMinToMax .8s 1.3s ease-out both;
}
</style>
</head>
 
<body>
 
<div class="page_box">
  <div class="page page1">
    <div class="page_body hide page1_body">
      <div class="page1_title">标题标题标题标题</div>
      <div class="scroll_box">
        <div>
          <p>行内滚动内容行内滚动内容行内滚动内容行内滚行内滚动内容行内滚动内容动内容行</p>
          <p>行内滚动内容行内滚动内容行内滚动内容行内滚行内滚动内容行内滚动内容动内容行</p>
          <p>行内滚动内容行内滚动内容行内滚动内容行内行内滚动内容行内滚动内容滚动内容行</p>
          <p>行内滚动内容行内滚动内容行内滚动内容行内滚动内容行内滚动内容行内滚动内容行</p>
          <p>行内滚动内容行内滚动内容行内滚动内容行内滚动内容行内滚动内容行内滚动内容行</p>
          <p>行内滚动内容行内滚动内容行内滚动内容行行内滚动内容行内滚动内容内滚动内容行</p>
          <p>行内滚动内容行内滚动内容行内滚动内容行内行内滚动内容行内滚动内容滚动内容行</p>
          <p>行内滚动内容行内滚动内容行内滚动内容行内行内滚动内容行内滚动内容滚动内容行</p>
        </div>
      </div>
    </div>
  </div>
  
  <div class="page page2">
    <div class="page_body hide page2_body scroll_box">
      <div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
        <div>22222222222</div>
      </div>
    </div>
  </div>
  
  <div class="page page3">
    <div class="page_body hide page3_body">
      <div>33333333333</div>
      <div>33333333333</div>
      <div>33333333333</div>
      <div>33333333333</div>
      <div>33333333333</div>
      <div>33333333333</div>
      <div>33333333333</div>
      <div>33333333333</div>
      <div>33333333333</div>
      <div>33333333333</div>
    </div>
  </div>
  
  <div class="arrow">
    <div>
      <svg class="icon" style="width: 1em;height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2859"><path d="M491.42 412.298c7.887 12.378 6.427 28.995-4.381 39.803L204.196 734.944l-90.51-90.51c-12.496-12.497-12.496-32.758 0-45.255L396.53 316.337l0.265 0.265 89.974-89.975c12.497-12.496 32.758-12.496 45.255 0l395.98 395.98-90.51 90.51c-12.497 12.497-32.758 12.497-45.255 0L491.42 412.297z" p-id="2860"></path></svg>
    </div>
    <div>
      <svg class="icon" style="width: 1em;height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2859"><path d="M491.42 412.298c7.887 12.378 6.427 28.995-4.381 39.803L204.196 734.944l-90.51-90.51c-12.496-12.497-12.496-32.758 0-45.255L396.53 316.337l0.265 0.265 89.974-89.975c12.497-12.496 32.758-12.496 45.255 0l395.98 395.98-90.51 90.51c-12.497 12.497-32.758 12.497-45.255 0L491.42 412.297z" p-id="2860"></path></svg>
    </div>
  </div>
</div>
 
<script type="text/javascript">
// element 作用区域(所有执行翻页页面的父级元素DOM)
// isLoop 是否循环执行翻页
// needScrollClass 执行翻页页面内部可滚动元素样式名
function setChangePage(element,isLoop,needScrollClass){
  // console.log(element.querySelectorAll('.page'));
  // console.log(element.querySelectorAll('.page').length);
  // console.log(element.querySelector('.page'));
  // console.log(element.querySelector('.page2'));
  var pageData = {
    curPage:1,
    prevPage:null,
    PageL:element.querySelectorAll('.page').length,
    type:null,
    canTouch:true,
    startY:0,
    endY:0,
    diff:0,
  }
  var startEvt,moveEvt,endEvt;
  if("ontouchstart" in window){
    // 移动端用户滑动事件
    startEvt = "touchstart";
    moveEvt = "touchmove";
    endEvt = "touchend";
  }else{
    // PC端鼠标移动事件
    startEvt = "mousedown";
    moveEvt = "mousemove";
    endEvt = "mouseup";
  }
  element.addEventListener(startEvt, touchStart, false);
  element.addEventListener(moveEvt, touchMove, false);
  element.addEventListener(endEvt, touchEnd, false);
  function touchStart(e){
    pageData.startY = startEvt == "touchstart" ? e.touches[0].pageY : e.pageY;
    pageData.endY = '';
    pageData.diff = '';
  }  
  function touchMove(e){
    e.preventDefault();
    pageData.endY = startEvt == "touchstart" ? e.touches[0].pageY : e.pageY;
    pageData.diff = pageData.endY - pageData.startY;
  }
  function touchEnd(e){
    if(Math.abs(pageData.diff) > 150 && pageData.canTouch){
      changeDoBefore(pageData.diff);
    }
    // setTimeout(function(){
      pageData.startY = '';
      pageData.endY = '';
      pageData.diff = '';
    // },500);
  }
  function changeDoBefore(diffNum){
    if(diffNum > 0){
      // 向下滑动进入前一页
      pageData.type = 2;
      if(pageData.curPage <= 1){
        if(isLoop){
          pageData.prevPage = 1;
          pageData.curPage = pageData.PageL;
          changeDo();
        }
      }else{
        pageData.prevPage = pageData.curPage;
        pageData.curPage--;
        changeDo();
      }
    }else{
      // 向上滑动进入下一页
      pageData.type = 1;
      if(pageData.curPage >= pageData.PageL){
        if(isLoop){
          pageData.prevPage = pageData.PageL;
          pageData.curPage = 1;
          changeDo();
        }
      }else{
        pageData.prevPage = pageData.curPage;
        pageData.curPage++;
        changeDo();
      }
    }
  }
  function changeDo(){
    if(pageData.type == 1){
      element.querySelector('.page' + pageData.prevPage).classList.remove('inTop' , 'outTop' , 'inDown' , 'outDown');
      element.querySelector('.page' + pageData.prevPage).classList.add('outTop');
      element.querySelector('.page' + pageData.curPage).classList.remove('inTop' , 'outTop' , 'inDown' , 'outDown');
      element.querySelector('.page' + pageData.curPage).classList.add('inTop');
      element.querySelector('.page' + pageData.curPage).querySelector('.page_body').classList.remove('hide');
    }else if(pageData.type == 2){
      element.querySelector('.page' + pageData.prevPage).classList.remove('inTop' , 'outTop' , 'inDown' , 'outDown');
      element.querySelector('.page' + pageData.prevPage).classList.add('outDown');
      element.querySelector('.page' + pageData.curPage).classList.remove('inTop' , 'outTop' , 'inDown' , 'outDown');
      element.querySelector('.page' + pageData.curPage).classList.add('inDown');
      element.querySelector('.page' + pageData.curPage).querySelector('.page_body').classList.remove('hide');
    }
 
    if(needScrollClass && startEvt == "touchstart"){
      scrollEleData.canTouch = false;
      setTimeout(function(){
        scrollEleData.canTouch = true;
      },500);
    }
 
    pageData.canTouch = false;
    setTimeout(function(){
      pageData.canTouch = true;
      element.querySelector('.page' + pageData.prevPage).querySelector('.page_body').classList.add('hide');
    },500);
    // 不循环切换时设置最后一页时隐藏向上箭头
    if(pageData.curPage >= pageData.PageL){
      if(!isLoop){
        element.querySelector('.arrow').classList.add('hide');
      }
    }else{
      if(!isLoop){
        element.querySelector('.arrow').classList.remove('hide');
      }
    }
    // 执行翻页页面内部可滚动时,设置进入页面后滚动条位置
    if(needScrollClass && element.querySelector('.page' + pageData.curPage).querySelector('.' + needScrollClass)){
      element.querySelector('.page' + pageData.curPage).querySelector('.' + needScrollClass).scrollTop = 0;
    }
  }
  // 执行翻页页面内部可滚动(移动端需要)
  if(needScrollClass && startEvt == "touchstart"){
    var scrollEleData = {
      canTouch:true,
      startY:0,
      endY:0,
      diff:0,
    }
    // console.log(element.querySelectorAll('.' + needScrollClass).length);
    element.querySelectorAll('.' + needScrollClass).forEach(function(item,index){
      // console.log(item,index);
      item.addEventListener("touchstart", scrollEleTouchStart, false);
      item.addEventListener("touchmove", scrollEleTouchMove, false);
      item.addEventListener("touchend", scrollEleTouchEnd, false);
      function scrollEleTouchStart(e){
        // e.stopPropagation();
        element.removeEventListener("touchmove", touchMove, false);
        scrollEleData.startY = e.touches[0].pageY;
        scrollEleData.endY = '';
        scrollEleData.diff = '';
      }  
      function scrollEleTouchMove(e){
        scrollEleData.endY = e.touches[0].pageY;
        scrollEleData.diff = scrollEleData.endY - scrollEleData.startY;
      }
      function scrollEleTouchEnd(e){
        element.addEventListener("touchmove", touchMove, false);
        // console.log(scrollEleData.canTouch);
        if(Math.abs(scrollEleData.diff) > 150 && scrollEleData.canTouch){
          changeDoBefore(scrollEleData.diff);
        }
        // setTimeout(function(){
          scrollEleData.startY = '';
          scrollEleData.endY = '';
          scrollEleData.diff = '';
        // },500);
      }
      item.addEventListener("scroll", scrollDo, false);
      function scrollDo(e){
        // console.log(e.target.clientHeight , e.target.scrollTop , e.target.scrollHeight);
        if((e.target.clientHeight + e.target.scrollTop + 2 >= e.target.scrollHeight) || (e.target.scrollTop == 0)){
          setTimeout(function(){
            scrollEleData.canTouch = true;
          },500);
        }else{
          scrollEleData.canTouch = false;
        }
      }
    })
  }
  // 
  window.onload = function(){
    element.querySelectorAll('.page').forEach(function(item,index){
      console.log(index)
      if(index > 0){
        item.classList.add('outTop');
      }else{
        item.classList.add('inTop');
        item.querySelector('.page_body').classList.remove('hide');
      }
    })
  }
}
 
/***************************/
 
// 例:
// 循环执行翻页
setChangePage(document.getElementsByClassName('page_box')[0],'loop','scroll_box');
// 不循环执行翻页
// setChangePage(document.getElementsByClassName('page_box')[0],'','scroll_box');
 
</script>
</body>
</html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/984024.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

突破传统显示技术,探索OLED透明屏的亮度革命

OLED透明屏作为未来显示技术的颠覆者&#xff0c;其亮度性能成为其引人注目的特点之一。 那么&#xff0c;今天尼伽便深入探讨OLED透明屏的亮度&#xff0c;通过引用数据、报告和行业动态&#xff0c;为读者提供高可读性和专业性强的SEO软文&#xff0c;增加可信度和说服力。 …

计算机丢失mfc140.dll怎么办,分享几种常见解决方案[dll修复工具下载】

一、mfc140.dll 的详细介绍 1.mfc140.dll 的作用 MFC140.dll 是 MFC 的一个组件&#xff0c;它提供了许多用于创建 Windows 应用程序的类和函数&#xff0c;如窗口管理、控件、对话框、菜单、消息处理等。这些类和函数可以帮助开发者更轻松地开发图形用户界面&#xff08;GUI&a…

【Linux】shell脚本和bat脚本:

文章目录 一、脚本对应环境&#xff1a;【1】shell&#xff1a;linux环境&#xff1b;后缀名为.sh【2】bat&#xff1a;windows环境&#xff1b;后缀名为.bat或者.cmd 二、脚本执行&#xff1a;【1】shell执行【2】bat脚本执行 三、脚本相关命令&#xff1a;1. shell命令【1】s…

【UE】材质描边、外发光、轮廓线

原教学视频链接&#xff1a; ue4 材质描边、外发光、轮廓线_哔哩哔哩_bilibili 步骤 1. 首先新建一个材质&#xff0c;这里命名为“Mat_outLine” 在此基础上创建一个材质实例 2. 在视口中添加一个后期处理体积 设置后期处理体积为无限范围 点击添加一个数组 选择“资产引用”…

如何将JACOCO应用到企业实战中~测试过招,只需6点

1、下载 jacoco 官网&#xff1a;https://www.jacoco.org/jacoco/index.html 如果你想学习自动化测试&#xff0c;我这边给你推荐一套视频&#xff0c;这个视频可以说是B站播放全网第一的自动化测试教程&#xff0c;同时在线人数到达1000人&#xff0c;并且还有笔记可以领取及…

Win10右键 nvidia rtx desktop manager 怎么删除(最新)

在更新了最新的 nvidia后原来的隐藏鼠标右键菜单后不行了&#xff0c;新方法如下&#xff1a; 步骤一&#xff1a;在键盘“WINR”键同时操作下&#xff0c;启动运行框&#xff0c;在框内输入“regedit”&#xff0c;打开深度系统win7 的注册表编辑器。 步骤二&#xff1a;为防…

Spring学习|Bean的作用域、自动装配Bean、注解实现自动装配、Spring注解开发

Bean的作用域 单例模式(Spring默认机制) 原型模式:每次从容器中get的时候&#xff0c;都会产生一个新对象! Bean的自动装配 自动装配是Spring满足bean依赖一种方式! Spring会在上下文中自动寻找&#xff0c;并自动给bean装配属性! 在Spring中有三种装配的方式 1.在xml中显示的…

在字节跳动和拼多多干了5年测试,熬夜总结出来的划水经验....

先简单交代一下背景吧&#xff0c;某不知名 985 的本硕&#xff0c;17 年毕业加入字节&#xff0c;之后跳槽到了拼多多&#xff0c;一直从事软件测试的工作。之前没有实习经历&#xff0c;算是5年的工作经验吧。 这5年之间完成了一次晋升&#xff0c;换了一家公司&#xff0c;…

java八股文面试[数据库]——MySQL死锁的原因和处理方法

1) 表的死锁 产生原因: 用户A访问表A&#xff08;锁住了表A&#xff09;&#xff0c;然后又访问表B&#xff1b;另一个用户B访问表B&#xff08;锁住了表B&#xff09;&#xff0c;然后企图访问表A&#xff1b;这时用户A由于用户B已经锁住表B&#xff0c;它必须等待用户B释放…

ZooInspector

一、在window&#xff0c;使用我们先打开Zookeeper,目录bin下的zkServer.cmd&#xff0c;把Zookeeper运行起来 ​编辑https://img.111com.net/attachment/art/187687/5f0c25fbe580c.png 二、可以使用目录bin下的zkCli.cmd&#xff0c;查询Zookeeper数据的方式&#xff0c;但是…

大模型浪潮席卷!和鲸科技入选创业邦“2023值得关注的125家AIGC企业”榜单

为以专业视角发掘现阶段积极探索 AIGC 技术和应用的企业&#xff0c;对接企业与场景&#xff0c;推动技术落地&#xff0c;创业邦于近日发布了“2023 值得关注的 125 家 AIGC 企业”榜单&#xff0c;和鲸科技凭借旗下 ModelWhale 数据科学协同平台在承载气象大模型的构建与应用…

企业怎么选择广告片的投放途径

TVC广告片和宣传片都是常见的企业营销工具&#xff0c;每种形式都有各自的特点和适用场景。选择哪种形式更适合企业投放&#xff0c;取决于多个因素&#xff0c;包括目标受众、营销目标、预算和信息传递需求等。接下来由深圳TVC广告片制作公司老友记小编从以下几个方面介绍它们…

【Python报错解决方案】DeprecationWarning: `np.float` is a deprecated

报错amoconda libsite-packages sklearn linear model least ngl.py30: Deprecationmarming: mp.float is a deprecated alias for the builtinfloat , To silence this warning, wse flat by itself. Doing this will not modify amy behavior and is safe. If you specifical…

机器学习基础算法--回归类型和评价分析

目录 1.数据归一化处理 2.数据标准化处理 3.Lasso回归模型 4.岭回归模型 5.评价指标计算 1.数据归一化处理 """ x的归一化的方法还是比较多的我们就选取最为基本的归一化方法 x(x-x_min)/(x_max-x_min) """ import numpy as np from sklea…

python超详细基础教程:元组和集合

前言 嗨喽~大家好呀&#xff0c;这里是魔王呐 ❤ ~! 元组和集合是Python中的基本类型 python更多源码/资料/解答/教程等 点击此处跳转文末名片免费获取 一&#xff0c;元组 元组&#xff08;tuple&#xff09;由小括号、逗号和数据对象构成的集合&#xff0c;各个项通过逗号…

毕业设计-摄像头识别二维码

本毕业设计采用imx6ull-linux4.1.15-qt5.6开发板进行测试 相关交叉编译包和摄像头测试程序已上传&#xff1a;https://download.csdn.net/download/qq_42952079/88282608 将zbar和opencv下的lib库文件拷贝到开发板的lib目录下&#xff0c;将camera可执行文件拷贝到开发板目录下…

解锁前端Vue3宝藏级资料 第四章 VUE常用 UI 库 1 ( element-plus,Ant ,naiveui,ArcoDesign)

现在常用的前台UI 分别是以下几种&#xff0c;我们将从中间选择介绍几个主流的UI的用于后台的系统搭建与开发。 Ant Design Vue element-plusnaiveuiArcoDesignBootstrap Vue Buefy Chakra UI Framevuerk Oruga Tachyons Tailwind CSS NutUI Vant Vuetify.js第一章 Vue3项目创建…

[machine Learning]推荐系统

其实严格来说推荐系统也是一种监督学习,我们需要根据已有数据进行预测,但是这种训练数据不是单纯的输入和输出问题,所以被归类为"超越监督学习"的一种? 今天去旁听了隔壁专业的机器学习课程,感觉自己的知识确实不是很系统,所以后面会找个机会把前面的代码给补充上.…

【肝素··】

Recent advances in the management of venous thromboembolism Korean J Hematol 2010;45:8-13 Serpin Structure, Mechanism, and Function-2002 糖胺聚糖 凝血 Fibrinolysis | Detailed Pedia

2023百度云智大会:科技与创新的交汇点

​ 这次的百度云智大会&#xff0c;可谓是亮点云集—— 发布了包含42个大模型、41个数据集、10个精选应用范式的全新升级千帆大模型平台2.0&#xff0c;发布首个大模型生态伙伴计划&#xff0c;而且也预告了文心大模型4.0的发布&#xff0c;大模型服务的成绩单也非常秀&#x…