2021-04-04 12:59:48 +02:00
|
|
|
|
|
|
|
var $jq = jQuery.noConflict();
|
|
|
|
$jq( document ).ready(function() {
|
|
|
|
console.log( "ready!" );
|
|
|
|
var b = $jq("body");
|
|
|
|
b.css("margin-top", "0px");
|
|
|
|
b.css("margin-left", "0px");
|
|
|
|
b.css("margin-right", "0px");
|
|
|
|
b.css("margin-bottom", "0px");
|
|
|
|
$jq(".modal").css("width","auto");
|
|
|
|
|
|
|
|
$jq('input').each(function(){
|
|
|
|
var self = $jq(this),
|
|
|
|
label = self.next(),
|
|
|
|
label_text = label.text();
|
|
|
|
|
|
|
|
label.remove();
|
|
|
|
self.iCheck({
|
|
|
|
checkboxClass: 'icheckbox_line-purple',
|
|
|
|
radioClass: 'iradio_line-purple',
|
|
|
|
insert: '<div class="icheck_line-icon"></div>' + label_text
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//fisso i bottoni ad una certa larghezza
|
|
|
|
$jq( "div[class^='icheckbox_line']" ).css( "max-width", "200px" );
|
|
|
|
// sposto i bottoni in alto a dx ma relativamente al loro container
|
|
|
|
$jq('ul').css({
|
|
|
|
position: "absolute",
|
|
|
|
marginLeft: 0, marginTop: 0,
|
|
|
|
top: 0, left: 0
|
|
|
|
});
|
|
|
|
//aggiungo l'on clicked alle checkbox
|
|
|
|
$jq('input').on('ifChecked', function(event){
|
2021-04-07 08:33:57 +02:00
|
|
|
for (let i=0; i<pois.length; i++) {
|
|
|
|
|
|
|
|
var img = null;
|
|
|
|
if(this.id == pois[i].cat){
|
2021-04-07 12:59:33 +02:00
|
|
|
//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;"/>');
|
2021-04-07 08:33:57 +02:00
|
|
|
img.click(function(){ // handle click
|
|
|
|
var c = $jq("#container_" + pois[i].type);
|
|
|
|
|
2021-04-07 12:59:33 +02:00
|
|
|
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();
|
2021-04-07 08:33:57 +02:00
|
|
|
});
|
2021-04-07 12:59:33 +02:00
|
|
|
// $jq('body').delay(Math.floor(Math.random() * 1001)).append( img );
|
|
|
|
// $jq('body').append('').delay(2000).queue(function (next) {
|
|
|
|
// $jq(this).append(img);
|
|
|
|
// next();
|
|
|
|
// });
|
2021-04-07 08:33:57 +02:00
|
|
|
$jq('body').append( img );
|
2021-04-07 12:59:33 +02:00
|
|
|
img.animate({top: pois[i].y + 'px'});
|
|
|
|
img.animate({left:pois[i].x + 'px'});
|
2021-04-07 08:33:57 +02:00
|
|
|
}
|
|
|
|
}
|
2021-04-06 12:42:52 +02:00
|
|
|
//qui ci va un foreach suoi poi
|
2021-04-07 08:33:57 +02:00
|
|
|
});
|
2021-04-04 12:59:48 +02:00
|
|
|
|
|
|
|
$jq('input').on('ifUnchecked', function(event){
|
2021-04-06 12:42:52 +02:00
|
|
|
//qui ci va un foreach suoi poi
|
2021-04-07 08:33:57 +02:00
|
|
|
for (let i=0; i<pois.length; i++) {
|
|
|
|
if(this.id == pois[i].cat){
|
|
|
|
$jq('#pin_'+i).remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2021-04-07 12:59:33 +02:00
|
|
|
|
|
|
|
$jq( "[id^='container_']" ).on($jq.modal.AFTER_CLOSE, function(event, modal) {
|
2021-04-07 08:33:57 +02:00
|
|
|
modal.$elm.html('');
|
2021-04-04 12:59:48 +02:00
|
|
|
});
|
2021-04-07 12:59:33 +02:00
|
|
|
|
|
|
|
// $jq('#container_T').on($jq.modal.AFTER_CLOSE, function(event, modal) {
|
|
|
|
// modal.$elm.html('');
|
|
|
|
// });
|
2021-04-04 12:59:48 +02:00
|
|
|
|
|
|
|
});
|
|
|
|
|