JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Window › reposition initial window
- This topic has 7 replies, 2 voices, and was last updated 3 years, 11 months ago by Hristofor.
-
AuthorPosts
-
December 1, 2020 at 4:17 pm #101200edwardsmarkfMember
hello – this is probably obvious but i am missing it.
what is the best way to specify where a window will INITIALLY open? i have had success using css & top/left, but before i pursue this any further i wanted to see if the htmlElements wizards had a much better way.
thank you.December 2, 2020 at 8:13 am #101201HristoforMemberHi edwardsmarkf,
By default theSmart.Window component
is positioned via CSS using thetop/left
CSS properties. However if the Window has been resized/dragged you will have to set thetop/left
inline in order to take precedence. So initially it is correct to style it via CSStop/left
properties.
Best Regards,
Christopher
Smart HTML Elements Team
https://www.htmlelements.comDecember 11, 2020 at 8:27 pm #101221edwardsmarkfMemberthanks, but when i try to set the top/left properties and open MINIMIZED, it seems to override whatever top/left properties i set.
also, when using the ‘minimize’ event, that event triggers before the minimize takes place, and overrides it there as well. i could possibly have some sort of timeout event, but i wanted to ask here first to see if there is a better way?December 11, 2020 at 11:41 pm #101222edwardsmarkfMemberthis works, sort of:
window.onload = () => { const smartWindow = document.querySelector('smart-window'); smartWindow.headerButtons = ['collapse', 'minimize', 'pin']; smartWindow.addEventListener('minimize', (event) => { setTimeout( () => { document.querySelector('smart-window').style.left = '300px' ; }, 100); }); };
December 12, 2020 at 4:30 pm #101227edwardsmarkfMemberreposting question here: https://www.htmlelements.com/forums/topic/locating-minimized-window/
December 12, 2020 at 9:00 pm #101232edwardsmarkfMembercould you please show me a working example of setting top/left?
December 13, 2020 at 12:51 am #101233edwardsmarkfMemberhttps://codepen.io/edwardsmarkf/pen/abmppNK?editors=1111 — getting closer…. 😁
December 18, 2020 at 12:57 pm #101245HristoforMemberHi edwardsmarkf,
Changing the position of the Smart.Window while minimized is not possible via the API of the element at the moment. The default position of the window when minimized is the bottom left corner of the viewport. Every other minimized window will be positioned right next to it. Theminimize
event should not be used to change the position of the minimized window.
Best Regards,
Christopher
Smart HTML Elements Team
https://www.htmlelements.com
Tags:
web components, web component, custom element, smart elements, smart framework -
AuthorPosts
- You must be logged in to reply to this topic.