使用方法
HTML代码
<div id="hacker-list">
<ul class="list">
<li>
<h3 class="name">Jonny</h3>
<p class="city">Stockholm</p>
</li>
<li>
<h3 class="name">Jonas</h3>
<p class="city">Berlin</p>
</li>
</ul>
</div>
Javascript代码
var options = {
valueNames: [ 'name', 'city' ]
};
var hackerList = new List('hacker-list', options);
初始化并创建列表
HTML代码
<div id="hacker-list">
<ul class="list"></ul>
</div>
JavaScript代码
var options = {
item: '<li><h3 class="name"></h3><p class="city"></p></li>'
};
var values = [
{ name: 'Jonny', city:'Stockholm' }
, { name: 'Jonas', city:'Berlin' }
];
var hackerList = new List('hacker-list', options, values);