forked from johno/pixyll
/
index.html
78 lines (68 loc) · 2.37 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
layout: default
---
<head>
<title>Random Image</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
(function($){
$.randomImage = {
defaults: {
//you can change these defaults to your own preferences.
path: '/images/', //change this to the path of your images
myImages: ['cover.jpg', 'cover2.jpg', 'cover3.jpg', 'cover4.jpg', 'cover5.jpg', 'cover6.jpg', 'cover7.jpg' ] //put image names in this bracket. ex: 'harold.jpg', 'maude.jpg', 'etc'
}
};
$.fn.extend({
randomImage:function(config) {
var config = $.extend({}, $.randomImage.defaults, config);
return this.each(function() {
var imageNames = config.myImages,
//get size of array, randomize a number from this
// use this number as the array index
imageNamesSize = imageNames.length,
lotteryNumber = Math.floor(Math.random()*imageNamesSize),
winnerImage = imageNames[lotteryNumber],
fullPath = config.path + winnerImage;
//put this image into DOM at class of randomImage
// alt tag will be image filename.
$(this).attr({
src: fullPath,
alt: winnerImage
});
});
}
});
}(jQuery));
$(document).ready(function(){
$('img:first').randomImage();
});
</script>
</head>
<body>
<img>
</body>
<ul>
<li><a href="./cv/">CV</a></li>
<li><a href="./pubs/">Publications</a></li>
<li><a href="./code/">Code</a></li>
</ul>
<hr>
<div class="home">
<div class="posts">
{% for post in paginator.posts %}
<div class="post">
<p class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</p>
<a href="{{ post.url | prepend: site.baseurl }}" class="post-link"><h3 class="h2 post-title">{{ post.title }}</h3></a>
<p class="post-summary">
{% if post.summary %}
{{ post.summary }}
{% else %}
{{ post.excerpt }}
{% endif %}
</p>
</div>
{% endfor %}
</div>
{% include pagination.html %}
</div>