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 | + "</li>";
|
22 | }
|
23 | kittens += "</ul>";
|
24 | $('body').append(kittens);
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | $('ul').fillwidth({ imageDimensions: imageDimensions });
|
30 | });
|
31 | </script>
|
32 | <style>
|
33 | li {
|
34 | margin: 0 15px 15px 0;
|
35 | }
|
36 | img {
|
37 | height: 200px;
|
38 | background: #eee;
|
39 | }
|
40 | </style>
|
41 | </head>
|
42 |
|
43 | <body>
|
44 | </body>
|
45 | </html>
|