EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: angers on August 04, 2012, 04:10:15 PM



Title: $.messager slide origin position
Post by: angers on August 04, 2012, 04:10:15 PM
I really like your messager, but I've been struggling to figure out a way to change the origin point of the 'showType' option.

Code:
$.messager.show({
title:'My Title',
msg:'Message will be closed after 5 seconds.',
timeout:5000,
showType:'slide'
});

If I want a $.messager instance to slide in from the top of the page, instead of the bottom...how do I do this?


NOTE:

I see that I can hardcode the change in jquery.messager.js, obviously:

Code:
win.window("window").css({
left: "",
top: "",
right: 0,
zIndex: $.fn.window.defaults.zIndex++,
bottom: -document.body.scrollTop - document.documentElement.scrollTop
});


But this is highly undesirable because as a matter of practice I'll have to convert all of these hacks manually on the next release. I'm trying to figure out a way to prototype the function while retaining scope for all the private variables you reference...



Wish you would have just added a position option.


Title: Re: $.messager slide origin position
Post by: angers on August 04, 2012, 05:01:21 PM

This is the best thing I could come up with. I wish you would have made the private methods accessible with getters instead of making everything impossible to access if it's not in the defaults.

Code:
win.window("window").css({left:"",top:0,right:0,zIndex:$.fn.window.defaults.zIndex++});


Title: Re: $.messager slide origin position
Post by: stworthy on August 07, 2012, 12:07:50 AM
This feature will be supported in next version. Please download the preview messager plugin from http://www.jeasyui.com/easyui/plugins/jquery.messager.js.

Some usage examples:
Code:
// show message window on top left
$.messager.show({
title:'My Title',
msg:'Message will be closed after 4 seconds.',
showType:'show',
style:{
left:0,
right:'',
top:document.body.scrollTop+document.documentElement.scrollTop,
bottom:''
}
});
// show message window on bottom left
$.messager.show({
title:'My Title',
msg:'Message will be closed after 4 seconds.',
showType:'show',
style:{
left:0,
right:'',
top:'',
bottom:-document.body.scrollTop-document.documentElement.scrollTop
}
});
// show message window on top right
$.messager.show({
title:'My Title',
msg:'Message will be closed after 4 seconds.',
showType:'show',
style:{
left:'',
right:0,
top:document.body.scrollTop+document.documentElement.scrollTop,
bottom:''
}
});
// show message window on center
$.messager.show({
title:'My Title',
msg:'Message will be closed after 4 seconds.',
showType:'show',
style:{
right:'',
bottom:''
}
});
// show message window on top center
$.messager.show({
title:'My Title',
msg:'Message will be closed after 4 seconds.',
showType:'show',
style:{
right:'',
top:document.body.scrollTop+document.documentElement.scrollTop,
bottom:''
}
});