I'm working on a windowing application for a website of mine. Right now, I have each individual window set up as a in the body of the site. I add new windows by literally adding the appropriate code to the end of the body element, and delete them by removing that div. (I'm using jQuery for the underlying JavaScript architecture.)
I've found that for each window, I want to be able to store some values that aren't used directly. Say I maximize a window, I would want to save its old position and size so that when I un-maximize it, it returns to its old position and not just to somewhere random. So my real question here is, would it be legal to create custom CSS attributes (knowing full well that the browser would ignore them) with the sole purpose of keeping information like this on a per-div basis? Or would this be illegal, and should I look at another alternative?
I'm certainly familiar with methods of keeping all of this in an array so the system can run blind with it, but that's lovely and prone to errors and things, and it would still be a bit tricky to work with.
Thanks
I would use jQuery's data()
method instead for storing temp data.
$('div#window').data('position', { x: 100, y: 200, width: 50, height: 50});
$('div#window').data('state', 'minimized');
References:
You can also make this data persistent by storing it in cookies or in session at server side and restore it on the client when page loads. This way, window’s position and state will be kept even if user reloads the page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With