1 頁面固定大小javascript
<style> .abc{ border:1px solid #000;margin:0 auto;} @media screen and (min-width: 1349px) { .abc {width:1920px} } @media screen and (max-width: 1600px) { .abc {width: 1349px} } /* 設置了瀏覽器寬度不大於1200px時 abc 顯示900px寬度 */ </style>
2 CSS動態效果css
頭部應用 <head> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css"> <!-- or --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css"> </head> 例如: <h1 class="animated flipInY">Example</h1> 效果網址: https://daneden.github.io/animate.css/
3 右側音樂插件html
<div id="audio">
<div>
<img src="images/bofang.png" alt=""/>
</div>
</div>
<audio src="http://59.110.224.45/HTMusic/xiaye.mp3" autoplay="" loop="" muted=""></audio>
<script> window.onload = function(){ var openNub = 0; var bOff = false;/*默認關閉音樂 */ var oLi = null; var oAudio = document.getElementById('audio'); var aAudio = document.getElementsByTagName('audio'); var button = oAudio.getElementsByTagName('div')[0]; var oImg = button.getElementsByTagName('img')[0]; var bOff; location.href.replace(/audio=(\D+)/,function($1,$2){ bOff = $2=='true'? true : false; }); oAudio.bOff = bOff || false; sound(); oAudio.onclick = sound; function sound(){ oAudio.bOff = !oAudio.bOff; for(var i=0; i<aAudio.length; i++){ aAudio[i].muted = oAudio.bOff; } if(oAudio.bOff){ button.style.webkitTransform = 'translate(0)'; button.style.transform = 'translate(0)'; oImg.src = 'images/jingyin.png'; }else{ button.style.webkitTransform = 'translate(32px)'; button.style.transform = 'translate(32px)'; oImg.src = 'images/bofang.png'; } } }; </script>
3 左側時間插件java
<div class="left_time"> <div class="smallDate" id="smallDate"> <div class="date_main"> <div class="date_left"> <ul class="styleCircle"> <li></li><li></li><li></li><li></li> </ul> <div class="main"> <p class="month"></p> <p class="day"></p> </div> </div> <div class="date_right"> <p class="time"></p> <p class="date"></p> <p class="week"></p> </div> </div> </div> </div> <script type="text/javascript" src="js/smallDate.js"></script> <script type="text/javascript"> window.onload = function(){ myDesk.init(); new Drag().init({id:"smallDate"}); new tmCalender({id : "Mycalendar"}).init(); }; </script> http://daydayup11.cn/js/smallDate.js
4 圖片輪播node
<div class="abc sui-container" id="banner"> <!--圖片--> <div class="pic"> <img src="http://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/106/106-bigskin-1.jpg"> <img src="http://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/107/107-bigskin-5.jpg"> <img src="http://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/106/106-bigskin-3.jpg"> <img src="http://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/106/106-bigskin-4.jpg"> <img src="http://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/106/106-bigskin-1.jpg"> <img src="http://game.gtimg.cn/images/yxzj/img201606/skin/hero-info/106/106-bigskin-3.jpg"> </div> <!--按鈕--> <div class="btn"> <ul> <li class="on">1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> </ul> </div> </div> <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.11.3.min.js"></script> <script type="text/javascript"> $(function(){ var index = 0; $('div.btn ul li').hover(function(){ var index = $(this).index(); $(this).addClass('on').siblings().removeClass('on'); $('div.pic img').eq(index).stop(true).fadeIn().siblings().stop(true).fadeOut(); },function(){}); var play = setInterval(auto,2000); $('#banner').hover(function(){ clearInterval(play); },function(){ }); function auto(){ index++; index%=6; $('div.btn ul li').eq(index).addClass('on').siblings().removeClass('on'); $('div.pic img').eq(index).stop(true).fadeIn().siblings().stop(true).fadeOut(); } }); </script>
5 極簡音樂插件jquery
<script> DNmusicPlay({ boxStyle:"right:20%;top:10px;opacity:1;", playbuttonSrc:"glyphicon glyphicon-volume-up", stopbuttonSrc:"glyphicon glyphicon-volume-off", nodeID:"dntest", audioUrl: [{title: "你瞞我瞞", source: "http://music.163.com/song/media/outer/url?id=25718007.mp3"} ,{title: "消愁", source: "http://music.163.com/song/media/outer/url?id=505221860.mp3"} ] }); </script> (function(global){ //定義播放器代碼 var __INFO__={ plug:"DNmusicPlay", version:"1.0.1", author:"haitao", }; var defaults = { audioUrl:"", nodeID:"", boxStyle:"", playbuttonSrc:"", stopbuttonSrc:"", htmls:` <audio autoplay loop style="width: 0px"> <source src="" type="audio/mpeg"> </audio> <span class=""></span> <select style="vert-align: top"> </select>`, html:` <audio autoplay loop style="width: 0px"> <source src="" type="audio/mpeg"> </audio> <a style="width:24px;height:24px;"></a> <select style="vert-align: top"> </select>`, }; var PlugCode = function(options){ var settings = Object.assign({},defaults,options); var audioDOM = document.getElementById(settings.nodeID);//獲取節點 if (!audioDOM) audioDOM = document.body;//用戶沒傳nodeid //建立div節點 var audioBox = document.createElement("div"); audioBox.id = "dnmusiccontrol"; audioBox.style ="opacity:1;overflow:hidden;position:absolute;"+settings.boxStyle;//指定位置 audioBox.innerHTML = settings.htmls; audioDOM.appendChild(audioBox);//將整個盒子插入 //尋找元素 var audioButton = audioBox.querySelectorAll("span")[0];//查找a元素 返回的不是節點 var audioList = audioBox.querySelectorAll("select")[0]; var audioTag = audioBox.querySelectorAll("audio")[0]; //pic // if(settings.buttonSrc) audioButton.style.backgroundImage="url("+settings.buttonSrc+")"; if(settings.playbuttonSrc) audioButton.className=settings.playbuttonSrc; //初始化防止第一次播放暫停 audioButton.state = true; var _urlType = toString.apply(settings.audioUrl); console.log(_urlType); if (_urlType =='[object Object]'){ var _temp = [];//====>[{},{}] _temp.push(settings.audioUrl);//字符串轉數組 settings.audioUrl=_temp; } if (!settings.audioUrl.length){ //沒傳值 console.log("legth:"+settings.audioUrl.length) console.log(__INFO__.plug +"無音樂資源,請添加audioUrl:") return; } if (typeof settings.audioUrl == 'object'){ //判斷是數組 console.log("數組對象自動播放") audioTag.src = settings.audioUrl[0].source; for (var i = 0;i < settings.audioUrl.length; i++){ var _option = new Option(settings.audioUrl[i].title,settings.audioUrl[i].source) audioList.add(_option); } }else { audioTag.src = settings.audioUrl; audioList.style.display = "none";//列表隱藏 } //點擊 var audioFN={ play:function(url){ if(url) audioTag.src = url; audioTag.play(); audioButton.className=settings.playbuttonSrc; }, stop:function(){ audioTag.pause(); audioButton.className=settings.stopbuttonSrc; }, }; //按鈕綁定shijian http://www.cnblogs.com/mrdoor/p/5560775.html var _device =(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))); var clickEvtName = _device ? "touchstart":"mousedown" audioButton.addEventListener(clickEvtName,function(e){ console.log(e.type) console.log(this.state) if (this.state){ this.state = false; audioFN.stop(); }else { this.state = true; audioFN.play(); } }); audioList.addEventListener("change",function(){//切歌 var musicName = this.options[this.selectedIndex].value;//去列表裏面的值 audioFN.play(musicName); audioButton.state = true; }); }; //微信 if(navigator.userAgent.toLowerCase().match(/micromessenger/i)){ document.addEventListener("WeixinJSBridgeReady",function onBridgeReady(){ WeixinJSBridge.invoke("getNetworkType",{},function(e){ audioFN.play(); }) }) } global.DNmusicPlay = PlugCode; })(typeof window !== "undefined" ? window :this);//閉包