I tried putting the method in setInterval in quotations, which runs continuously but it won't allow me to pass parameters so in turn it does nothing. The way I have it now passes parameters but doesn't run continuously.


$('#icon' + i).bind('click', function() {
var icon = this.id;
var iconID = setInterval(iconExpand(icon),5);
});

function iconExpand(obj) {
var mLeft = $('#' + obj).css('margin-left');
var mTop = $('#' + obj).css('margin-top');
if (iNum < 300) {
iNum += 2;
$('#' + obj).css({ width : iNum + 'px', height : iNum + 'px', borderRadius : iNum/2 + 'px' })
.css({ marginLeft : (mLeft.split('px')[0] - 1 + 'px'), marginTop : (mTop.split('px')[0] - 1 + 'px') })
.css('-moz-border-radius',iNum/2 + 'px').css('-webkit-border-radius',iNum/2 + 'px');
} else {
clearInterval(icondID)
}
}