added basic image loader...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-06-08 16:43:44 +04:00
parent 0fadf170b3
commit 5a4a7ceb05
7 changed files with 44 additions and 6 deletions

View File

@ -100,8 +100,43 @@ $(document).ready(function() {
// set the default position...
$('.current-image').click()
// load images...
// XXX not allowed...
//$.getJSON('images.js', loadImages})
// XXX STUB
loadImages({
images:[
'images/350px/DSC_3501.jpg',
'images/350px/DSC_3503.jpg',
'images/350px/DSC_3504.jpg',
'images/350px/DSC_3506.jpg',
]
})
});
function loadImages(json){
// XXX STUB
var images = json.images
var ribbon = $('.ribbon').last()
$('.image').remove()
for(var i = 0; i < images.length; i++){
$('<div class="image mock-image"></div>')
.css({
background : 'url('+images[i]+') no-repeat 50% black',
'background-size': 'contain',
})
.click(handleClick)
.appendTo(ribbon)
}
ribbon.children().first().click()
}
// XXX jquery.gestures handler...
function handleGestures(e){
switch (e){
@ -251,15 +286,11 @@ function firstImage(){
}
function prevImage(){
$('.current-image')
.prev('.image')
.click()
$('.current-image').prev('.image').click()
}
function nextImage(){
$('.current-image')
.next('.image')
.click()
$('.current-image').next('.image').click()
}
function lastImage(){

7
ui/images.json Executable file
View File

@ -0,0 +1,7 @@
{
"images":[
"image 1",
"image 2",
"image 3"
]
}

BIN
ui/images/350px/DSC_3501.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
ui/images/350px/DSC_3503.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
ui/images/350px/DSC_3504.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
ui/images/350px/DSC_3506.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

0
ui/images/README Normal file
View File