|
@@ -1,5 +1,40 @@
|
|
|
|
|
|
var $jq = jQuery.noConflict();
|
|
|
+
|
|
|
+function addPin(poi,i){
|
|
|
+
|
|
|
+ // var img = $jq('<img id="pin_'+i+'" src="asset/i_'+poi.cat+'_48.png" style="position:absolute;left:'+Math.floor(Math.random() * 1200)+'px;top:'+Math.floor(Math.random() * 700)+'px; display: block;visibility: visible;"/>');
|
|
|
+ var img = $jq('<img id="pin_'+i+'" src="asset/i_'+poi.cat+'_48.png" style="position:absolute;left:'+Math.floor($jq(window).width()/2)+'px;top:'+Math.floor($jq(window).height()/2)+'px; display: block;visibility: visible;"/>');
|
|
|
+ img.click(function(){ // handle click
|
|
|
+ var c = $jq("#container_" + poi.type);
|
|
|
+
|
|
|
+ if(poi.type=='T'){ //contenuto testuale
|
|
|
+ $jq.get("contents/"+poi.type+"_"+i+".html", function(html_string)
|
|
|
+ {
|
|
|
+ c.html('<div class="scrollable-content" id="sub_v">' + html_string + '</div>');
|
|
|
+ },'html');
|
|
|
+ }else if(poi.type=='V'){//contenuto video
|
|
|
+ c.html('<source src="contents/'+poi.type+'_'+i+'.mp4" type="video/mp4" />');
|
|
|
+ c.attr('currentTime',"0");
|
|
|
+ c.trigger('load');
|
|
|
+ c.trigger('play');
|
|
|
+ }else{//è un'immagine
|
|
|
+ c.html('<img src="contents/'+poi.type+'_'+i+'.jpg"/>');
|
|
|
+ }
|
|
|
+ c.modal();
|
|
|
+ });
|
|
|
+// $jq('body').delay(Math.floor(Math.random() * 1001)).append( img );
|
|
|
+// $jq('body').append('').delay(2000).queue(function (next) {
|
|
|
+ // $jq(this).append(img);
|
|
|
+ // next();
|
|
|
+// });
|
|
|
+ $jq('body').append( img );
|
|
|
+ img.delay(500);
|
|
|
+ img.animate({top: poi.y + 'px'},'fast');
|
|
|
+ img.animate({left:poi.x + 'px'},'fast');
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
$jq( document ).ready(function() {
|
|
|
console.log( "ready!" );
|
|
|
var b = $jq("body");
|
|
@@ -35,31 +70,7 @@ $jq( document ).ready(function() {
|
|
|
|
|
|
var img = null;
|
|
|
if(this.id == pois[i].cat){
|
|
|
- //var img = $jq('<img id="pin_'+i+'" src="asset/i_'+pois[i].cat+'_48.png" style="position:absolute;left:'+pois[i].x+'px;top:'+pois[i].y+'px; display: block;visibility: visible;"/>');
|
|
|
- var img = $jq('<img id="pin_'+i+'" src="asset/i_'+pois[i].cat+'_48.png" style="position:absolute;left:'+Math.floor(Math.random() * 1000)+'px;top:'+Math.floor(Math.random() * 1000)+'px; display: block;visibility: visible;"/>');
|
|
|
- img.click(function(){ // handle click
|
|
|
- var c = $jq("#container_" + pois[i].type);
|
|
|
-
|
|
|
- if(pois[i].type=='T'){ //contenuto testuale
|
|
|
- $jq.get("contents/"+pois[i].type+"_"+i+".html", function(html_string)
|
|
|
- {
|
|
|
- c.html('<div class="scrollable-content" id="sub_v">' + html_string + '</div>');
|
|
|
- },'html');
|
|
|
- }else if(pois[i].type=='V'){//contenuto video
|
|
|
- c.html('<source src="contents/'+pois[i].type+'_'+i+'.mp4" type="video/mp4" />');
|
|
|
- }else{//è un'immagine
|
|
|
- c.html('<img src="contents/'+pois[i].type+'_'+i+'.jpg"/>');
|
|
|
- }
|
|
|
- c.modal();
|
|
|
- });
|
|
|
-// $jq('body').delay(Math.floor(Math.random() * 1001)).append( img );
|
|
|
- // $jq('body').append('').delay(2000).queue(function (next) {
|
|
|
- // $jq(this).append(img);
|
|
|
- // next();
|
|
|
- // });
|
|
|
- $jq('body').append( img );
|
|
|
- img.animate({top: pois[i].y + 'px'});
|
|
|
- img.animate({left:pois[i].x + 'px'});
|
|
|
+ addPin(pois[i],i);
|
|
|
}
|
|
|
}
|
|
|
//qui ci va un foreach suoi poi
|
|
@@ -77,10 +88,14 @@ $jq( document ).ready(function() {
|
|
|
$jq( "[id^='container_']" ).on($jq.modal.AFTER_CLOSE, function(event, modal) {
|
|
|
modal.$elm.html('');
|
|
|
});
|
|
|
-
|
|
|
+ for (let i=0; i<pois.length; i++) {
|
|
|
+ if($jq('#' + pois[i].cat).is(":checked")) {
|
|
|
+ addPin(pois[i],i);
|
|
|
+ }
|
|
|
+ }
|
|
|
// $jq('#container_T').on($jq.modal.AFTER_CLOSE, function(event, modal) {
|
|
|
// modal.$elm.html('');
|
|
|
// });
|
|
|
-
|
|
|
});
|
|
|
|
|
|
+
|