全网整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:400-708-3566

js微信应用场景之微信音乐相册案例分享

这个demo只是一个js微信音乐相册案例大概思路,具体还需要根据情况来进行

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="reset.css" rel="external nofollow" >
  <link rel="stylesheet" href="swiper.min.css" rel="external nofollow" >
  <link rel="stylesheet" type="text/css" href="animate.css" rel="external nofollow" >
  <style>
    html,body{
      width:100%;
      height:100%;
      overflow:hidden;
    }
    html{
      font-size:100px;/*设计稿640*960*/
    }
    .main,.swiper-container,.swiper-slide{
      width:100%;
      height:100%;
      overflow:hidden;
    }
    .page1{
      position:relative;
      background:url("../img/swiper/bg1.jpg") no-repeat;
      background-size:cover;
    }
    .page1 img{
      position:absolute;  
      opacity:0;    
    }
    .page1 img:nth-child(1){
      left:2rem;
      top:.28rem;
      width:.96rem;
      height:2.32rem;  
        
    }
    .page1 img:nth-child(2){
      right:0;
      top:.28rem;
      width:3.7rem;
      height:6rem;      
    }
    .page1 img:nth-child(3){
      left:.5rem;
      bottom:.8rem;
      width:5.5rem;
      height:5.12rem;      
    }
    .page1 img:nth-child(4){
      left:-1.6rem;
      bottom:0;
      width:7.86rem;
      height:5.88rem;      
    }
    /*实现切换完成后页面中的元素在开始运动的思想:开始的时候当前的这个区域没有对应的ID,当切换到这个区域的时候,我们为其增加ID,在css中我们把所有的动画效果都放在指定的ID下,这样的话只需要让区域有ID,里面的子元素就有动画了*/
    #page1 img:nth-child(1){
      /*注意移动端的样式写两套 并且不加webkit的在后*/
      -webkit-animation:bounceInLeft 1s linear 0s 1 both;
      animation:bounceInLeft 1s linear 0s 1 both;  
    }
    #page1 img:nth-child(2){
      /*注意移动端的样式写两套 并且不加webkit的在后*/
      -webkit-animation:bounceInRight 1s linear .3s 1 both;
      animation:bounceInRight 1s linear .3s 1 both;  
    }
    #page1 img:nth-child(3){
      /*注意移动端的样式写两套 并且不加webkit的在后*/
      -webkit-animation:bounceInUp 1s linear .6s 1 both;
      animation:bounceInUp 1s linear .6s 1 both;  
    }
    #page1 img:nth-child(4){
      /*注意移动端的样式写两套 并且不加webkit的在后*/
      -webkit-animation:bounceInUp 1s linear .9s 1 both;
      animation:bounceInUp 1s linear .9s 1 both;  
    }
    .page2{
      position:relative;
      background:url("../img/swiper/bg2.jpg") no-repeat;
      background-size:cover;
    }
    .page2 img{
      position:absolute;
      top:2.5rem;
      opacity:0;
    }
    .page2 img:nth-child(1){
      top:0;
      left:0;
      width:3.4rem;
      height:1.74rem;
    }
    .page2 img:nth-child(2){
      left:1.48rem;
    }
    .page2 img:nth-child(3){
      left:3.2rem;
    }
    .page2 img:nth-child(4){
      left:4.7rem;
    }
    
    #page2 img:nth-child(1){
      -webkit-animation:bounceInLeft 1s linear 0s 1 both;
      animation:bounceInLeft 1s linear 0s 1 both;  
    }
    #page2 img:nth-child(2){
      -webkit-animation:zoomIn 1s linear .3s 1 both;
      animation:zoomIn 1s linear .3s 1 both;  
    }
    #page2 img:nth-child(3){
      -webkit-animation:zoomIn 1s linear .6s 1 both;
      animation:zoomIn 1s linear .6s 1 both;  
    }
    #page2 img:nth-child(4){
      -webkit-animation:zoomIn 1s linear .9s 1 both;
      animation:zoomIn 1s linear .9s 1 both;  
    }

    .arrow{
      position:absolute;
      left:50%;
      bottom:.2rem;
      z-index:10;
      margin-left:-.24rem;
      width:.48rem;
      height:.36rem;
      background:url("../img/swiper/web-swipe-tip.png") no-repeat;
      background-size:100% 100%;
      
      -webkit-animation:bounce 1s linear 0s infinite both;
      animation:bounce 1s linear 0s infinite both;
    }

    .music{
      display:none;
      position:absolute;
      top:.2rem;
      right:.2rem;
      z-index:10;
      width:.6rem;
      height:.6rem;
      background:url("../audio/music.svg") no-repeat;
      background-size:100% 100%;
    }
    .music.move{
      -webkit-animation :musicMove 1s linear 0s infinite both;
      animation :musicMove 1s linear 0s infinite both;
    }
    .music audio{
      display:none;
    }
    @-webkit-keyframes musicMove{
      0%{
        -webkit-transform:rotate(0deg);
        transform:rotate(0deg);
      }
      100%{
        -webkit-transform:rotate(360deg);
        transform:rotate(360deg);
      }
    }
    @keyframes musicMove{
      0%{
        -webkit-transform:rotate(0deg);
        transform:rotate(0deg);
      }
      100%{
        -webkit-transform:rotate(360deg);
        transform:rotate(360deg);
      }
    }
  </style>
</head>
<body>
  <section class='main'>
    <!--MUSIC-->
    <div class='music' id='musicMenu'>
      <audio src="beyond.mp3" preload = 'none' loop autoplay></audio id='musicAudio'>
      <!-- <audio>
        <source src='beyond.mp3' type='audio/mpeg'/>
        <source src='beyond.wav' type='audio/wav'/>
        <source src='beyond.ogg' type='audio/ogg'/>
      </audio> -->
    </div>
    <!--CONTAINER-->
    <div class='swiper-container'>
      <div class='swiper-wrapper'>
        <div class='swiper-slide page1'>
          <img src="img/swiper/page1-text1.png" alt="">
          <img src="img/swiper/page1-text2.png" alt="">
          <img src="img/swiper/page1-text3.png" alt="">
          <img src="img/swiper/page1-text4.png" alt="">
        </div>
        <div class='swiper-slide page2'>
          <img src="img/swiper/page2-text1.png" alt="">
          <img src="img/swiper/page2-text2.png" alt="">
          <img src="img/swiper/page2-text3.png" alt="">
          <img src="img/swiper/page2-text4.png" alt="">
        </div>
      </div>
    </div>
    <!--ARROW-->
    <div class='arrow'></div>

    
  </section>
  <script charset='utf-8' src='swiper.min.js'></script>
  <script>
    //rem
    ~function(){
      var desW = 640,
        winW = document.documentElement.clientWidth,
        ratio = winW / desW,
        oMain = document.querySelector(".main");
      if(winW>desW){
        oMain.style.margin = "0 auto";
        oMain.style.width = desW + 'px';
        return;
      }
      document.documentElement.style.fontSize = ratio*100+"px";

    }()
    new Swiper('.swiper-container',{
      direction:"vertical",
      loop:true,
      /*当切换结束后,给当前展示的区域添加对应的ID,由此实现对应的动画效果*/
      onSlideChangeEnd:function(swiper){
        var slideAry = swiper.slides;//获取当前一共有多少个活动快(包含loop模式前后多加的两个)
        var curIn = swiper.activeIndex;//当前展示的这个区域的索引
        var total = slideAry.length;
        //计算ID是PAGE?
        var targetId = 'page';
        switch(curIn){
          case 0:
            targetId += total - 2;
            break;
          case total - 1:
            targetId += 1;
            break;
          default:
            targetId += curIn
        }

        //给当前的活动块设置ID即可,还要把其余的移除
        [].forEach.call(slideAry,function(item,index){
          if(curIn === index){
            item.id = targetId;
            return;
          }
          item.id = null;
        })
        slideAry[curIn].id = targetId;

        //最后把animate.css里面的动画to里面添加opacity:1
      }
    })

    //MUSIC
    ~function(){
      var musicMenu = document.getElementById('musicMenu'),
        musicAudio = document.getElementById('musicAudio');

      musicMenu.addEventListener('click',function(){
        if(musicAudio.paused){
          musicAudio.play();
          musicMenu.className = "music move";
          return;
        }
        musicAudio.pause();
        musicMenu.className = "music";

      })
      function controlMusic(){
        musicAudio.volume = 0.1;
        musicAudio.play();
        musicAudio.addEventListener('canplay',function(){
          musicMenu.style.display = "block";
          musicMenu.className = "music move";
        })
      }
      window.setTimeout(controlMusic,1000)
    }()
  </script>
</body>
</html>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。


# js微信音乐相册  # js微信应用场景  # js微信相册  # PHP实现微信JS-SDK接口选择相册及拍照并上传的方法  # 微信js-sdk预览图片接口及从拍照或手机相册中选图接口用法示例  # 不加  # 两套  # 放在  # 就有  # 只需  # 要把  # 为其  # 还需要  # 要让  # 只是一个  # 多加  # 画了  # 大家多多  # 切换到  # 移除  # 多少个  # 这样的话  # 结束后  # 完成后  # opacity 


相关文章: Thinkphp 中 distinct 的用法解析  北京制作网站的公司,北京铁路集团官方网站?  昆明网站制作哪家好,昆明公租房申请网上登录入口?  企业在线网站设计制作流程,想建设一个属于自己的企业网站,该如何去做?  高防网站服务器:DDoS防御与BGP线路的AI智能防护方案  如何在阿里云服务器自主搭建网站?  广平建站公司哪家专业可靠?如何选择?  定制建站流程步骤详解:一站式方案设计与开发指南  如何通过西部建站助手安装IIS服务器?  深圳网站制作案例,网页的相关名词有哪些?  建站之星免费模板:自助建站系统与智能响应式一键生成  ui设计制作网站有哪些,手机UI设计网址吗?  如何在IIS管理器中快速创建并配置网站?  文字头像制作网站推荐软件,醒图能自动配文字吗?  高配服务器限时抢购:企业级配置与回收服务一站式优惠方案  商务网站制作工程师,从哪几个方面把握电子商务网站主页和页面的特色设计?  网站制作外包价格怎么算,招聘网站上写的“外包”是什么意思?  存储型VPS适合搭建中小型网站吗?  如何在云指建站中生成FTP站点?  如何用花生壳三步快速搭建专属网站?  车管所网站制作流程,交警当场开简易程序处罚决定书,在交警网站查询不到怎么办?  免费ppt制作网站,有没有值得推荐的免费PPT网站?  手机钓鱼网站怎么制作视频,怎样拦截钓鱼网站。怎么办?  如何在Golang中使用replace替换模块_指定本地或远程路径  如何实现建站之星域名转发设置?  小米网站链接制作教程,请问miui新增网页链接调用服务有什么用啊?  Android滚轮选择时间控件使用详解  制作国外网站的软件,国外有哪些比较优质的网站推荐?  如何快速生成可下载的建站源码工具?  如何通过虚拟主机空间快速建站?  网站制作大概多少钱一个,做一个平台网站大概多少钱?  移动端手机网站制作软件,掌上时代,移动端网站的谷歌SEO该如何做?  建站之星2.7模板:企业网站建设与h5定制设计专题  C#如何使用XPathNavigator高效查询XML  在线ppt制作网站有哪些,请推荐几个好的课件下载的网站?  怎么制作网站设计模板图片,有电商商品详情页面的免费模板素材网站推荐吗?  北京专业网站制作设计师招聘,北京白云观官方网站?  三星网站视频制作教程下载,三星w23网页如何全屏?  潮流网站制作头像软件下载,适合母子的网名有哪些?  智能起名网站制作软件有哪些,制作logo的软件?  如何在IIS中新建站点并配置端口与IP地址?  建站主机是否属于云主机类型?  如何高效利用200m空间完成建站?  建站之星安装步骤有哪些常见问题?  清单制作人网站有哪些,近日“兴风作浪的姑奶奶”引起很多人的关注这是什么事情?  css网站制作参考文献有哪些,易聊怎么注册?  视频网站制作教程,怎么样制作优酷网的小视频?  正规网站制作公司有哪些,目前国内哪家网页网站制作设计公司比较专业靠谱?口碑好?  新网站制作渠道有哪些,跪求一个无线渠道比较强的小说网站,我要发表小说?  南平网站制作公司,2025年南平市事业单位报名时间? 

您的项目需求

*请认真填写需求信息,我们会在24小时内与您取得联系。