EasyUI Forum
May 20, 2024, 03:08:25 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Responsive dialog  (Read 8693 times)
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« on: May 25, 2014, 03:03:24 AM »

I started to play with Mobile examples and they looks nice! Is there any example of how to declare some responsive form/dialog/window?
Or any hint of how to use dialog on Mobile devices?
Thanks!
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 25, 2014, 05:43:16 PM »

The possible solution to make a dialog responsive is to listen to the window's resize event and adjust the size of this dialog. The code below is the simple implementation to achieve this functionality.
Code:
$.extend($.fn.window.methods,{
fluid: function(jq){
if (!$._fluid){
$._fluid = true;
$(window).unbind('.fluid').bind('resize.fluid',function(){
$('div.window').children('div.window-body').window('fluid');
})
}
return jq.each(function(){
var ww = $(window).width();
var opts = $(this).window('options');
if (ww < opts.maxWidth + 50){
$(this).window('resize',{
width: ww - 50
});
} else {
$(this).window('resize',{
width:opts.maxWidth
})
}
$(this).window('center');
})
}
});

Notice that the 'maxWidth' property must be set to limit the width of dialog. Some code looks like this:
Code:
$('#dlg').dialog({
  maxWidth:600
}).dialog('fluid');
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #2 on: May 25, 2014, 09:36:27 PM »

Hello
great, thanks a lot.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!