内容来自:玩转Django2.0 黄永祥
1)require.js的作用
用法说明:https://www.runoob.com/w3cnote/requirejs-tutorial-1.html
调用:require([], function($){...})
require.config({ paths: { "jquery": "jquery.min", "com": "common" } }); require(['jquery','com'], function ($,com){ ... })
定义:define([], function($){...})
define(['jquery'], function($){
//直接执行的函数
$('.rank-list').on('mouseenter', 'li', function(){...}); //显示图片,供调用的函数 function showImg(){ $('.layz_load').each(function(i,e){ var img = $(e).find('img');...}); } ... //tab标签切换,供调用的函数 function tabSwitch(tab,con,callback){ tab.on('click','.t_c',function(){...}); } ... return { showImg:showImg, tabSwitch:tabSwitch //这是其中定义的函数,不知道有什么作用? ..., }; });
1)<li>:
(1)多行<li>,如果设置了<li>的float: left;两个<li>文字会显示在一行;
2)<ul>
(1)<ul>子结构中<li>文字头部不会有空格,不会有点号;而且<li>文字在<ul>左顶开始;
ul{
margin:0;
padding:0;
}
ul{
list-style: none
}
3)不要注释掉.min.js中某个函数,否则会导致后面的函数无效?可以注释某个函数中某一部分代码。
4).hover :hover
(1).hover选择器并不会生效,需要在.css中用jquery添加,如下所示;
$('#J_CategoryItems').on({'mouseenter':function(){
$(this).addClass('hover').siblings().removeClass('hover');
},'mouseleave':function(){
$(this).removeClass('hover');
}
},'.item');
(2)如果你是对多行列表统一设置了样式,对某行需要单独进行hover,需要对每行单独添加一个class=".item",即.category-items .item:hover{background-color: red;}
(2).category-items .hover的子结构是这样的:.category-tems .hover a:hover{}