Limit Widgets to Sidebar ID’s

First, my English is not good, sorry about that.

I have widgets. I want to limit them by sidebars ID’s. I did that but it’s working only moving widget left to sidebar areas. But when I reload page, (current in sidebar area) right widgets can move everywhere. I want to limit this.

I limited them by widget title and widget ID’s. If it finding widget title in sidebar id, then it’s limiting. But I think you understand my problem.

My current codes:

$(document).ready(function() {
$(“body”).on( ‘dragcreate dragstart dragend sortcreate sortstart sortend’, ‘.widget’, function( event, ui ) {
id = $(this).find( ‘.widget-title h3’ ).text();
mytxt = “Hedef ID’ler: “;
if( id.indexOf(mytxt)>=0 ) {
yeniid = id.replace(mytxt, “”).trim();
$( yeniid ).sortable({
revert: true,
connectWith: yeniid
});
$(this).draggable({
connectToSortable: yeniid, //limit drop event only to these sidebars
helper: “clone”,
revert: “invalid”
});
$( “ul, li” ).disableSelection();
}
});
});

Thanks in advance.

Read more here:: Limit Widgets to Sidebar ID’s

Leave a Reply

Your email address will not be published. Required fields are marked *