javascript - Variable does not work with alsoResize: -
i got code, wich works fine, until change '.1' colselect. guess because gets value late , when want use colselect havent registerd. have ideas on how solve this?
$(document).ready(function() { var colselect; $('.test2').mousedown( function(){ colselect = '.' + $(this).attr('id'); }); $( '#1' ).resizable( {handles:'e'}, {alsoresize: '.1'} // <- here change '.1' colselect ); });
updated:
$(document).ready(function() { var colselect; $('#one').on('mouseover' ,mousedwn); function mousedwn(){ colselect = '.' + $(this).attr('id'); resize(colselect); } $('#one').on('mouseout' ,function(){ $('#one').off('mouseover' ,mousedwn); //prevent memory leaks }); }); function resize(para){ $( '#1' ).resizable( {handles:'e'}, {alsoresize: para} ); }
Comments
Post a Comment