开发者

jquery resizable from attribute

i managed to resize multiple classes

$('.s').resizable({ alsoResize: '.1,.2,.3' });

but i want to get the alsoresizable objects from the attribute in the main object i resize. how can i get the attribute values there?

i tried:

<script>
开发者_JS百科$(document).ready(function() {
    $( ".resizable" ).resizable({
        maxHeight: 100,
        maxWidth: 162,
        minHeight: 14,
        minWidth: 162,

        alsoResize: "."+$(this).attr('number')+" "
    });
});
</script>

but its not working. can someone help?

here is a jfiddle for testing: Fiddle


You could build up the list with $.each or maybe $.map:

$.map($('your-selector'), function (element) { 
    return '.' + $(element).attr('number'); 
}).join(',')


this works:

js:

$(".res").mouseover(function() {
    //alert($(this).attr("number"));
    $(".res").resizable( "option", "alsoResize", $(this).attr("number") );
    });

$(".res").resizable({
    });

html:

<div id="div" class="a res ui-widget ui-widget-content" number=".b">Test A</div>
<div id="div" class="b res ui-widget ui-widget-content" number=".c">Test B</div>
<div id="div" class="c res ui-widget ui-widget-content" number=".a,.b">Test C</div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜