Skip to content

Instantly share code, notes, and snippets.

@clytras
Created November 17, 2016 16:07
Show Gist options
  • Save clytras/98e6a6fb9a7adf008f55ec11fc783229 to your computer and use it in GitHub Desktop.
Save clytras/98e6a6fb9a7adf008f55ec11fc783229 to your computer and use it in GitHub Desktop.
function addCircle(options) {
$('#clickAreas').append(
$('<div/>', {
id: options.hotspotid,
title: options.title,
'class': 'circle',
css: {
top: options.top+'px',
left: options.left+'px',
width: options.width+'px',
height: options.height+'px'
}
}).tooltip({
track:true,
tooltipClass: 'circle-tooltip'
}).on('click', function() {
$('.circle.do-anim > *').removeClass('anim');
$('.circle.do-anim').removeClass('do-anim');
$(this).addClass('do-anim');
$('.back-circle-1, .back-circle-2', this).addClass('anim');
changeStyle($(this).prop('id'));
}).append(
$('<div class="back-circle-1"/>'),
$('<div class="back-circle-2"/>'),
$('<div class="front-circle"/>')
)
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment