音乐相册源码php,分享使用JavaScript制作微信音乐相册实例
这篇文章主要为大家分享了js微信应用场景之微信音乐相册案例,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
这个demo只是一个js微信音乐相册案例大概思路,具体还需要根据情况来进行
Document
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);
}
}
//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)
}()
音乐相册源码php,分享使用JavaScript制作微信音乐相册实例相关推荐
- Java精品项目源码第109期精美风在线音乐网站
Java精品项目源码第109期精美风在线音乐网站 大家好,小辰今天给大家介绍一个基于Dao + Servlert + Jsp实现的前端 + 后台管理结合的精美风在线音乐网站系统,演示视频文章末尾公众号 ...
- 抖音程序员HTML相册,快手抖音程序员表白女朋友3D立体相册源码html网页相册代码...
前几天分享了一套源码,今天又为大家带来一套类似的源码,希望大家喜欢! 快手抖音很火的程序员女朋友3D立体相册源码html网页相册代码,经测试在IE8浏览器下无法预览,建议使用支持HTML5与css3效 ...
- 基于Java毕业设计音乐管理系统源码+系统+mysql+lw文档+部署软件
基于Java毕业设计音乐管理系统源码+系统+mysql+lw文档+部署软件 基于Java毕业设计音乐管理系统源码+系统+mysql+lw文档+部署软件 本源码技术栈: 项目架构:B/S架构 开发语言: ...
- 【开源项目学习】源码剖析,学习仿网易云音乐app代码
[前言] 这篇文字不全是讲app代码,而是博主怎么根据代码系统学习梳理的过程,非专业,如有不对,欢迎指出 仿网易云音乐app源码地址:https://github.com/aa112901/remus ...
- java计算机毕业设计花田音乐网站源码+mysql数据库+系统+lw文档+部署
java计算机毕业设计花田音乐网站源码+mysql数据库+系统+lw文档+部署 java计算机毕业设计花田音乐网站源码+mysql数据库+系统+lw文档+部署 本源码技术栈: 项目架构:B/S架构 开 ...
- 直播视频app源码的分享功能,是这样实现的
直播视频app源码拥有大量的用户和直播内容,为了方便用户分享平台内容,直播视频app源码实现了分享到第三方的功能,下面就是直播视频app源码实现分享功能的代码. <!doctype html&g ...
- [附源码]计算机毕业设计Python+uniapp基于微信小程序平台开发的音乐播放器f0rrr(程序+lw+远程部署)
[附源码]计算机毕业设计Python+uniapp基于微信小程序平台开发的音乐播放器f0rrr(程序+lw+远程部署) 该项目含有源码.文档.程序.数据库.配套开发软件.软件安装教程 项目运行环境配置 ...
- 百度SEO站群音乐聚合源码/自动采集(在线可播放)
看着搜索引擎的聚合搜索源码满天飞,我就发个音乐的聚合源码吧,一个PHP就能搭建一个音乐站(抓取某狗音乐站点),全自动更新采集音乐,MV,等等-可自定义添加广告,源码全开源无加密,可二开~源码自适应手机 ...
- 知秋源码解读分享系列
作为一个乐于分享的人,我希望通过一些成熟优秀的代码库,来向大家展示读源码思路以及阐述编程方面的技巧,也希望大家从中思考并得到属于自己的一套编程方法论. 半年以来,已进行72小时时长的源码解读分享视频录 ...
- java固定资产设备管理系统(源码开源分享)
推荐两款固定资产管理系统源码,代码完整,功能较完善,适合学习. 源码免费分享,需要源码学习可私信我. ▶▶▶1:IT设备管理--固定资产管理系统 系统概述 系统对常用资产设备进行信息化管理,包括资产增 ...
最新文章
- (pytorch-深度学习系列)pytorch卷积层与池化层输出的尺寸的计算公式详解
- capture one 20 pro中文版
- OSChina 周四乱弹 —— 澳门首家货车上线啦
- Prometheus Targets动态配置
- 通过Blazor使用C#开发SPA单页面应用程序(2)
- 【CodeForces - 1047C】Enlarge GCD(数学,枚举,预处理打表,思维)
- JVM学习-StringTable字符串常量池
- css布局:多列等高布局
- POJ3122-Pie
- eclipse svn插件离线安装
- 感冒为什么会流鼻涕?
- 收到了两家公司的offer怎么选择?
- 王菲微博“逗贫”语录暴光
- 总结jQuery中的DOM节点属性
- 华三模拟器的错误使用方法
- python numpy是什么_Python库Numpy里ndarray.ndim 是什么意思?
- webapp新建文件没有JSP问题和IDEA中web.xml的<servlet-name>名字一样还飘红的问题
- IDEA提示方法参数的快捷键
- stm32小车红外对管的循迹
- 用html5label写一个简单的按钮功能