jquerypage分页插件怎么使用?
如何使用: $("#page").Page({ totalPages: 14,//total Pages liNums: 7,//the li numbers(advice use odd) activeClass: 'activP', //active class style firstPage: '首页',//first button name lastPage: '末页',//last button name prv: '?',//prev button name next: '?',//next button name hasFirstPage: true,//whether has first button hasLastPage: true,//whether has last button hasPrv: true,//whether has prev button hasNext: true,//whether has next button callBack : function(page){ //callBack function,page:active page } });
jQuery中filter()方法用法实例?
filter最简单的用法呢就是刷选现有的条件,如一组div,需要选出类名为selector的那么就使用filter('selector'),这种方式类似于选择器用法。第二种呢是自定义刷选,你可以依托jQuery的filter方法写出自己的拓展刷选方法,一下是官方例子:
list item 1 - one strong tag
list item 2 - two strong tags
list item 3
list item 4
list item 5
list item 6
$('li').filter(function(index) {return $('strong', this).length == 1; }).css('background-color', 'red');作者的目标很明确,想找出内部标记只有一个strong的li元素。这样单纯的取值方式自然不能适应。于是作者自己写了一个方法。filter(function(index){ 辨别条件 },index用来记录返回的li的索引值。你也看到了,ul里面有一组li,那么我怎么知道哪个是我想要的呢。这边filter方法就提供了一个强大的入口。jquery下拉菜单显示不出来?
一、问题描述
做下拉菜单时,不管怎么触发事件,下拉菜单都不显示。console一下,发现其display一直是none。
.second>li{ width: 300px; height: 30px; list-style: none; background-color: grey; color: #fff; border-bottom: .5px #fff solid; /*页面刷新时不显示,触发事件后显示*/ display: none; }
二、问题发现
原因是因为,“display: none;”放错地方了,跟li放一起。但事件触发的是父元素ul,所以无法更改其displaynone属性。
三、解决
/*display: none;单独放出来,不要跟li放一起*/ .second{ display: none; }
新开一个块控制父级元素,用对应的展开/收起动画控制即可。

