Reputation: 23
I am facing an issue I have a div that i wanna be resizing using custom handles.
handles: {
'nw': '.tl',
'ne': '.tr',
'sw': '.bl',
'se': '.br',
'e': '.r',
'w': '.l'
}
so I set the class for every direction. But when I execute the nw,w and sw can't resize from the left, in fact they act as if they are new e and se. Here is a live code to understand more.
http://jsfiddle.net/zhgouqc3/1/
Upvotes: 0
Views: 605
Reputation: 30903
Consider the following example:
https://jsfiddle.net/Twisty/cdLn56f1/
HTML
<div id="vidsub" style="position: relative; width: 417px; height: 53px; margin: 10px;background: red; z-index: 100;">
sdsds
<div class="l ui-resizable-handle ui-resizable-w resizable-wrapper" id="w"></div>
<div class="r ui-resizable-handle ui-resizable-e resizable-wrapper" id="e"></div>
<div class="tl ui-resizable-handle ui-resizable-nw" id="nw"></div>
<div class="tr ui-resizable-handle ui-resizable-ne" id="ne"></div>
<div class="bl ui-resizable-handle ui-resizable-sw" id="sw"></div>
<div class="br ui-resizable-handle ui-resizable-se" id="se"></div>
</div>
CSS
.ui-resizable-handle {
position: absolute;
width: 12px;
height: 12px;
background: rgb(255, 0, 106);
border-width: 1.5px;
border-style: solid;
border-color: rgb(255, 255, 255);
border-image: initial;
border-radius: 999px;
}
.resizable-wrapper {
width: 8px;
height: 16px;
}
.l {
left: -4px;
top: calc(50% - 10px);
}
.r {
right: -4px;
top: calc(50% - 10px);
}
.tl {
left: -6px;
top: -6px;
}
.tr {
right: -6px;
top: -6px;
}
.bl {
left: -6px;
bottom: -6px;
}
.br {
right: -6px;
bottom: -6px;
}
JavaScript
$(function() {
$('#vidsub').resizable({
handles: {
'nw': '.tl',
'ne': '.tr',
'sw': '.bl',
'se': '.br',
'e': '.r',
'w': '.l'
}
});
});
Please review the Docs:
Note: When generating your own handles, each handle must have the
ui-resizable-handle
class, as well as the appropriateui-resizable-{direction}
class, .e.g.,ui-resizable-s
.
So you have to adjust your Classes to fit the needs for handles. This will handle a lot of the cursors and CSS. Also your Fiddle was not setup correctly, corrected that.
Upvotes: 1