Problem using drag and drop
Hello,
I`m having a problem with my drag and drop code.
Accountnaam: admin
Wachtwoord: Admin
(The website language is dutch)
If you start draging the blocks to a new position it will lose the option bar above.
Jquery code i`m using
- $(function() {
-
- $(".column").sortable({
-
- scrollSensitivity: 5,
- cursor: 'move',
- connectWith: '.column',
-
- start: function(event, ui){
-
- // Get value
- var text = $.trim(ui.item.text());
- var html = ui.item.html();
- var optionshtml = $(".options").html();
- var width = $.trim(ui.item.width());
- var height = $.trim(ui.item.height()) / 4;
- var atrvalue = $('.options').attr('linked');
- ui.item.startHtml = ui.item.html();
- ui.item.html('<div style="width: '+ width +'px; border: 1px dashed #FF4D00; padding: 15px; background-color: #B8E24F; opacity: 0.7;"><div class="options">'+ optionshtml +'</div>'+ html +'</div>');
- $('.column').addClass('selected');
- },
-
- stop: function(event, ui){
- ui.item.html(ui.item.startHtml);
- $('.column').removeClass('selected');
- },
-
- update: function(e, ui) {
- if (this === ui.item.parent()[0]) {
- var strokeid = ui.item.closest('.column').attr('id');
- var order = $(this).sortable("serialize") + '&update=update&s=' + strokeid;
- $.post("/controller/blocks/updateBlocks.php", order, function(theResponse){
- $('.column').removeClass('selected');
- });
- }
- }
-
- });
- });
-
- // Debug Drag drop on active CKEditor
- function PreventDragDropEvent() {
- $(".column").sortable('disable');
- }
- function StartDragDropEvent() {
- $(".column").sortable('enable');
- }
My page.tpl code
- <!-- START BLOCK : StrokeList -->
- <div class="column" id="stroke_{id}" style="width: {width}%;">
- <!-- START BLOCK : Blocks -->
- <div class="options" style="width: {width}%;" linked="arrayorder_{id}"><img src="/controller/images/delete.png"> <img src="/controller/images/settings.png"></div>
- <div class="portlet" id="arrayorder_{id}" style="width: {width}%;" contenteditable="true" onblur="StartDragDropEvent();" onfocus="PreventDragDropEvent();">
- {content}
- </div>
- <!-- END BLOCK : Blocks -->
- </div>
- <!-- END BLOCK : StrokeList -->
Please try out the draging part of the website to see the problem in action.
Any help would be great.
Danny
(Sorry for my bad English)