|
|
Line 10: |
Line 10: |
| <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | | <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> |
| | | |
− | <script>
| |
− | function $$(id){
| |
− | var el=document.getElementById(id);
| |
− | return el;
| |
− | }
| |
− | function $C$(Class){
| |
− | var el=document.getElementsByClassName(Class);
| |
− | return el;
| |
− | }
| |
− | function $T$(Tag){
| |
− | var el=document.getElementsByTagName(Tag);
| |
− | return el;
| |
− | }
| |
| | | |
− | function getChildNodes(el, tagName) {
| + | <style> |
− | var nodes = [];
| + | |
− | for (var i = 0; i < el.childNodes.length; i++){
| + | |
− | if (el.childNodes[i].tagName == tagName) nodes.push(el.childNodes[i]);
| + | |
− | }
| + | |
− | return nodes;
| + | |
− | }
| + | |
| | | |
− |
| |
− | function scrollTopNow(){
| |
− | var scrolltop=document.documentElement.scrollTop||document.body.scrollTop;
| |
− | return scrolltop;
| |
− | }
| |
− | //有关类名字的方法
| |
− | function addClass(el, className) {
| |
− | if (hasClass(el, className)) {
| |
− | return;
| |
− | }
| |
− | let newClass = el.className.split(' ');
| |
− | newClass.push(className);
| |
− | el.className = newClass.join(' ');
| |
− | }
| |
− |
| |
− | function hasClass(el, className) {
| |
− | // \s匹配任何空白字符,包括空格、制表符、换页符等等
| |
− | let reg = new RegExp('(^|\\s)' + className + '(\\s|$)');
| |
− | return reg.test(el.className);
| |
− | }
| |
− | function removeClass(el, className){
| |
− | if (!hasClass(el, className)) {
| |
− | return;
| |
− | }
| |
− | let newClass = el.className.split(' ');
| |
− | newClass.forEach(function(val, index, newClass){
| |
− | if(val === className){
| |
− | newClass.splice(index,1);
| |
− | }
| |
− | }) ;
| |
− | el.className = newClass.join(' ');
| |
− | }
| |
− |
| |
− | //获取屏幕上滚高度
| |
− |
| |
− |
| |
− | </script>
| |
− |
| |
− | <style>
| |
− | ul{
| |
− | list-style-type: none !important;
| |
− | }
| |
| .word { | | .word { |
| color: rgba(0,0,0,1.00); | | color: rgba(0,0,0,1.00); |