Created
January 24, 2012 16:20
-
-
Save hubertperron/1670930 to your computer and use it in GitHub Desktop.
Add qTip to JQueryUI datepicker date instances
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="calendrier"></div> | |
<script type="text/javascript"> | |
$(function(){ | |
$(".calendrier").datepicker({ | |
beforeShowDay: function(selectedDate){ | |
var evenements = <?php echo $activites_json ?>; | |
var active = false; | |
var cssClass = ''; | |
var titleAttr = ''; | |
$.each(evenements, function(index, evenement) { | |
var date = new Date(evenement.date * 1000); // conversion depuis un timestamp php | |
if (date.toDateString() == selectedDate.toDateString()) { | |
active = true; | |
cssClass = 'evenement'; | |
titleAttr = titleAttr + '<a href=|' + evenement.url + '|>' + evenement.nom + '</a><br />'; | |
} | |
}); | |
return [active, cssClass, titleAttr]; | |
} | |
}); | |
$('td[title]').livequery(function() { | |
$(this).qtip({ | |
content: { | |
text: $(this).attr('title').replace(/\|/g, '"') | |
}, | |
hide: { | |
fixed: true, | |
delay: 1000 | |
}, | |
show: { | |
solo: true | |
} | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment