javascript - How to make BootstrapDialog movable on mobile -


i'm using https://github.com/nakupanda/bootstrap3-dialog make dialog, on mobile phones dialog larger screen size. on desktop when change width same size mobile, can drag dialog header using mouse, can't done on mobile.

this screen size.

before dragging

the dialog after being dragged left.

after dragging

is there way make dialog dragable on mobile? or there better solution?

edit

i tried reproduce problem using simpler setup, shows different css used on .modal-dialog:

the problem:

the problematic one

the simpler setup:

simpler setup

and know problem css' min-width property. hack replacing property when creating bootstrapdialog

onshown: function() {   $('.modal-dialog').css('min-width', 'auto'); } 

for dialog sizes think answered in comments. dragging dialog around [draggable : true] on mobiles must change little bit in sourcecode.

bootstrap3-dialog not respond mobile events such touchstart, touchend , touchmove {reference}.

take @ code line 1080 :
https://github.com/nakupanda/bootstrap3-dialog/blob/master/src/js/bootstrap-dialog.js#l1080

add mobile events bootstrap3-dialog can draggable on mobile devices :

... makemodaldraggable: function() {     if (this.options.draggable) {         this.getmodalheader().addclass(this.getnamespace('draggable')).on('mousedown touchstart', {             dialog:         }, function(event) {             var dialog = event.data.dialog;             dialog.draggabledata.ismousedown = true;             var dialogoffset = dialog.getmodaldialog().offset();             dialog.draggabledata.mouseoffset = {                 top: event.clienty - dialogoffset.top,                 left: event.clientx - dialogoffset.left             };         });         this.getmodal().on('mouseup mouseleave touchend touchcancel', {             dialog:         }, function(event) {             event.data.dialog.draggabledata.ismousedown = false;         });         $('body').on('mousemove touchmove', {             dialog:         }, function(event) {             var dialog = event.data.dialog;             if (!dialog.draggabledata.ismousedown) {                 return;             }             dialog.getmodaldialog().offset({                 top: event.clienty - dialog.draggabledata.mouseoffset.top,                 left: event.clientx - dialog.draggabledata.mouseoffset.left             });         });     }      return this; }, ... 

nb: untested, convinced (the only) way go.

nb²: refactor above meant here-and-now solution. should raise issue on github project site. sure authors think great idea make bootstrap3-dialog mobile ready too.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -