mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Fade through images :D.
This commit is contained in:
parent
316c8598c7
commit
3677c89bb0
3 changed files with 1569 additions and 17 deletions
|
|
@ -119,10 +119,11 @@ a.media-subheading:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.break {
|
.break {
|
||||||
display: block;
|
height: 144px;
|
||||||
height: 114px;
|
width: 760px;
|
||||||
background-repeat: no-repeat;
|
left: 50%;
|
||||||
background-position: center;
|
margin-left: -380px;
|
||||||
|
text-align: center;
|
||||||
margin-top: 2em;
|
margin-top: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
34
index.html
34
index.html
|
|
@ -115,8 +115,9 @@ root: .
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="{{page.root}}/js/jquery.cycle.all.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function() {
|
$(document).ready(function() {
|
||||||
var images = {
|
var images = {
|
||||||
1: 'Deadly Matter by Studio Dim Sum',
|
1: 'Deadly Matter by Studio Dim Sum',
|
||||||
2: 'Airship Dragoon by YorkshireRifes',
|
2: 'Airship Dragoon by YorkshireRifes',
|
||||||
|
|
@ -134,20 +135,27 @@ root: .
|
||||||
14: 'Villagers and Heroes by Mad Otter Games',
|
14: 'Villagers and Heroes by Mad Otter Games',
|
||||||
};
|
};
|
||||||
|
|
||||||
function addImages() {
|
|
||||||
var ids = shuffle(Object.keys(images));
|
|
||||||
var breaks = $('div.break');
|
|
||||||
breaks.each(function(i) {
|
|
||||||
$(this).attr('title', images[ids[i]]);
|
|
||||||
$(this).css('background-image', 'url({{page.root}}/img/banner'+ids[i]+'.jpg)');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
addImages();
|
|
||||||
|
|
||||||
function shuffle(o) {
|
function shuffle(o) {
|
||||||
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
|
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
|
function createBreaks() {
|
||||||
|
var breaks = $('div.break');
|
||||||
|
var delay = 0;
|
||||||
|
breaks.each(function(i) {
|
||||||
|
// Shuffle the list of pictures that will appear in each break.
|
||||||
|
var ids = shuffle(Object.keys(images));
|
||||||
|
for(var i = 0; i < ids.length; i++) {
|
||||||
|
$(this).append($('<img>')
|
||||||
|
.attr('src', '{{page.root}}/img/banner'+ids[i]+'.jpg')
|
||||||
|
.attr('title', images[ids[i]]));
|
||||||
|
}
|
||||||
|
$(this).cycle({fx: 'fade', delay: delay});
|
||||||
|
delay += 5000 / breaks.length;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
createBreaks();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
1543
js/jquery.cycle.all.js
Normal file
1543
js/jquery.cycle.all.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue