1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2 | "http://www.w3.org/TR/html4/loose.dtd">
|
3 | <html>
|
4 | <head>
|
5 | <title>Example</title>
|
6 | <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
|
7 | <script type="text/javascript" src="src/jquery.fillwidth.js"></script>
|
8 | <script>
|
9 | $(function(){
|
10 |
|
11 |
|
12 |
|
13 | var kittens = "<ul>"
|
14 | , imageDimensions = []
|
15 | , height = 200;
|
16 | for(var i = 0; i < 20; i++) {
|
17 | randWidth = Math.ceil(50 + (Math.random() * 600));
|
18 | imageDimensions.push({ width: randWidth, height: height });
|
19 | kittens += "<li>"
|
20 | + "<img src='http://placekitten.com/" + randWidth + "/" + height + "'>"
|
21 | + "<br><ul>"
|
22 | + "<li>Inner List</li>"
|
23 | + "<li>Item 2</li>"
|
24 | + "</ul>"
|
25 | + "</li>";
|
26 | }
|
27 | kittens += "</ul>";
|
28 | $('body').append(kittens);
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | $('body > ul').fillwidth({ imageDimensions: imageDimensions });
|
34 | });
|
35 | </script>
|
36 | <style>
|
37 | li {
|
38 | margin: 0 15px 15px 0;
|
39 | }
|
40 | img {
|
41 | height: 200px;
|
42 | background: #eee;
|
43 | }
|
44 | li > ul {
|
45 | display: inline;
|
46 | }
|
47 | </style>
|
48 | </head>
|
49 |
|
50 | <body>
|
51 | </body>
|
52 | </html>
|