EasyUI Forum
June 25, 2024, 12:04:40 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: Change window position? [SOLVED]  (Read 6194 times)
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« on: February 25, 2016, 12:04:52 AM »

How to change window position on first load or by the dynamic way?
already tried with bottom and right css but have no good results

see this fiddle: http://jsfiddle.net/22jL2hgt/

thank you in advance
« Last Edit: February 25, 2016, 02:19:55 AM by aswzen » Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
jarry
Administrator
Hero Member
*****
Posts: 2267


View Profile Email
« Reply #1 on: February 25, 2016, 02:00:08 AM »

Please try to extend a 'moveTo' method to achieve this functionality.
Code:
(function($){
    $.extend($.fn.window.methods, {
        moveTo: function(jq, param){
            return jq.each(function(){
                var win = $(this).window('window');
                var width = win.outerWidth();
                var height = win.outerHeight();
                var left = undefined;
                var top = undefined;
                if (param.indexOf('left') >= 0){
                    left = $(document).scrollLeft();
                }
                if (param.indexOf('right') >= 0){
                    left = $(window).outerWidth() - width + $(document).scrollLeft();
                }
                if (param.indexOf('top') >= 0){
                    top = $(document).scrollTop();
                }
                if (param.indexOf('bottom') >= 0){
                    top = $(window).outerHeight() - height + $(document).scrollTop();
                }
                $(this).window('move', {
                    left: left,
                    top: top
                });
            })
        }
    });
})(jQuery);

Call $('#win').window('moveTo', 'right bottom') to move a window to the right bottom corner. Please refer to http://jsfiddle.net/22jL2hgt/1/
Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #2 on: February 25, 2016, 02:19:48 AM »

wow amazing..thankyou jarry Cheesy
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
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!