-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
135 lines (108 loc) · 3.44 KB
/
example.html
File metadata and controls
135 lines (108 loc) · 3.44 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/beGridGalery.js"></script>
<style>
body {
background:#000;
}
.element {
border-radius: 10px 10px;
border:1px solid #FFF;
}
.element a {
text-decoration: none;
color: #FFF;
text-shadow: -1px -1px 1px #000,
-1px 1px 1px #000,
1px -1px 1px #000,
1px 1px 1px #000;
font-weight: bold;
}
</style>
<script>
$(document).ready(function() {
// ##################
// Helper to create Dummy-Images from flickr
var maxImages = 100; // max images to load...
var myImages = []; // List of images (src)
/**
* Load some random images from flickr
* Calls displayImages on result
*/
function loadImages() {
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?format=json&jsoncallback=?", function(data) {
// push the images into array...
$.each(data.items, function(i,item){
var img = (item.media.m); // .replace("_m.jpg", "_s.jpg");
myImages.push({size:Math.round(Math.random()*4)+1, url:img});
});
// enough images?
if (myImages.length < maxImages) {
loadImages(); // load more
}
else {
initGridGalery(); // enough! get started..
}
});
}
loadImages();
/**
* Start the GridGalery Code
* @return {[type]}
*/
function initGridGalery() {
// Init the Galery
$("#gridgalery").beGridGalery({
imageData:myImages, // twitter loaded images here...
getFieldHTML: function(imageData) { // customFieldHTML
var elementHTML = "<div class='element' >";
elementHTML+= imageData.id;
elementHTML+= "<a href='#' gridID='"+imageData.id+"' gridAction='sizePlus'>+</a> ";
elementHTML+= "<a href='#' gridID='"+imageData.id+"' gridAction='sizeMinus'>-</a> ";
elementHTML+= "<a href='#' gridID='"+imageData.id+"' gridAction='moveUp'><</a> ";
elementHTML+= "<a href='#' gridID='"+imageData.id+"' gridAction='moveDown'>></a> ";
elementHTML+= "</div>";
return elementHTML;
}
})
// Finds all links from customFieldHTML - and bind clickevent...
.find("a[gridAction]").bind("click", function(event) {
event.preventDefault();
var me = $(this);
var gridAction = me.attr("gridAction");
var imageID = me.attr("gridID");
// depends on the gridActionAttribute - which function to call of the galery - the official jQuery Way... Arg!
switch(gridAction)
{
case "sizePlus":
$("#gridgalery").beGridGalery("enlargeImage", {id:imageID});
break;
case "sizeMinus":
$("#gridgalery").beGridGalery("reduceImage", {id:imageID});
break;
case "moveUp":
$("#gridgalery").beGridGalery("moveUpImage", {id:imageID});
break;
case "moveDown":
$("#gridgalery").beGridGalery("moveDownImage", {id:imageID});
break;
}
// gridStage.empty();
// Place images onto the grid
$("#gridgalery").beGridGalery("placeImages");
// start the magic ;)
$("#gridgalery").beGridGalery("updateDom", {animate:true});
//myGrid.getDom().appendTo(gridStage);
})
}
})
</script>
</head>
<body>
<!-- Container for jQuery Plugin -->
<div id='gridgalery'>
</div>
</body>
</html>