dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: setInterval not running continuously

Hybrid View

  1. #1
    Join Date
    Apr 2010
    Location
    Brooklyn NY
    Posts
    104

    setInterval not running continuously

    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)
    }
    }

  2. #2
    Join Date
    Apr 2010
    Location
    Brooklyn NY
    Posts
    104

    resolved

    nevermind figured it out

    var iconID = setInterval(function() {iconExpand(icon)},5);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles