|
|
@@ -1,17 +1,55 @@
|
|
|
-(function (doc, win) {
|
|
|
- var docEl = doc.documentElement,
|
|
|
- resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
|
|
|
- recalc = function () {
|
|
|
- var clientWidth = docEl.clientWidth;
|
|
|
- if (!clientWidth) return;
|
|
|
- if(clientWidth>=640){
|
|
|
- docEl.style.fontSize = '100px';
|
|
|
- }else{
|
|
|
- docEl.style.fontSize = 100 * (clientWidth / 640) + 'px';
|
|
|
- }
|
|
|
- };
|
|
|
+document.addEventListener('readystatechange',function(){
|
|
|
+ //自适应
|
|
|
+ (function (doc, win) {
|
|
|
+ var docEl = doc.documentElement,
|
|
|
+ resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
|
|
|
+ recalc = function () {
|
|
|
+ var clientWidth = docEl.clientWidth;
|
|
|
+ if (!clientWidth) return;
|
|
|
+ if(clientWidth>=640){
|
|
|
+ docEl.style.fontSize = '100px';
|
|
|
+ }else{
|
|
|
+ docEl.style.fontSize = 100 * (clientWidth / 640) + 'px';
|
|
|
+ }
|
|
|
+ };
|
|
|
+ if (!doc.addEventListener) return;
|
|
|
+ win.addEventListener(resizeEvt, recalc, false);
|
|
|
+ doc.addEventListener('DOMContentLoaded', recalc, false);
|
|
|
+ })(document, window);
|
|
|
|
|
|
- if (!doc.addEventListener) return;
|
|
|
- win.addEventListener(resizeEvt, recalc, false);
|
|
|
- doc.addEventListener('DOMContentLoaded', recalc, false);
|
|
|
-})(document, window);
|
|
|
+ //点击分类
|
|
|
+ var btn = document.getElementsByClassName("fenlei");
|
|
|
+ var classify = document.getElementsByClassName("classify");
|
|
|
+ var btn1 = btn[0];
|
|
|
+ var btn2 = btn[1];
|
|
|
+ var btn3 = btn[2];
|
|
|
+ var classify1 = classify[0];
|
|
|
+ var classify2 = classify[1];
|
|
|
+ var classify3 = classify[2];
|
|
|
+
|
|
|
+ btn1.onclick = function(){
|
|
|
+ btn1.classList.add("click");
|
|
|
+ btn2.classList.remove("click");
|
|
|
+ btn3.classList.remove("click");
|
|
|
+ classify1.classList.add("showClassify");
|
|
|
+ classify2.classList.remove("showClassify");
|
|
|
+ classify3.classList.remove("showClassify");
|
|
|
+ }
|
|
|
+ btn2.onclick = function(){
|
|
|
+ btn2.classList.add("click");
|
|
|
+ btn1.classList.remove("click");
|
|
|
+ btn3.classList.remove("click");
|
|
|
+ classify2.classList.add("showClassify");
|
|
|
+ classify1.classList.remove("showClassify");
|
|
|
+ classify3.classList.remove("showClassify");
|
|
|
+ }
|
|
|
+ btn3.onclick = function(){
|
|
|
+ btn3.classList.add("click");
|
|
|
+ btn1.classList.remove("click");
|
|
|
+ btn2.classList.remove("click");
|
|
|
+ classify3.classList.add("showClassify");
|
|
|
+ classify1.classList.remove("showClassify");
|
|
|
+ classify2.classList.remove("showClassify");
|
|
|
+ }
|
|
|
+
|
|
|
+})
|