Hello guys
As mentioned in another one of my posts, I want the site I am working on to show a message when cookies are disabled on the user’s browser. Eventually, I want it animated in a way that both the cookie message and the main part moves down, displaying the cookies message. The animation part I was able to get running, thanks to the inputs I got from members of this forum.
The issues I now have is when I try to align the elements. I deleted all the extra bits and pieces in order to keep only the part where it shows the two elements in question, trying to figure out where the problem was but I could not find anything. Since I want the main part to be always there, I put the code creating those elements in the Open event and I put the cookies message commands in the Shown event, so it will appear only after the page is drawn and after I was able to check if the cookies are enabled or not. Since I want both parts to be in the middle, I put a LockHorizontal property on both items.
Now, I found that there is a difference of about 8 pixels between the two elements even though I am using the exact same commands, but again, one in the Open event and one in the Shown event. Furthermore, the main part will move when the window is resized, keeping it in the middle, but not the cookie part.
If I put all the code in the Open event, they will align properly align and they will stay in the middle if the window is resized. If all of the code is in the Shown event, they will be in the middle but will not move when the window is resized.
Maybe the answer is to create both containers in the Open event but keep the cookies one not visible until I need it, and if I need it. But won’t that slow the Website? Furthermore, I don’t think it is a good idea to create all the necessary containers upfront even if they are not visible instead of creating them dynamically as needed. just to make sure they are centered in the page. The other solution I thought about was to create an empty container in the Open event in which I could create all other containers as needed, elsewhere in the code.
Now, I am trying to ascertain if the issues in with my browser (even though I tried both Firefox and Chrome with the same results), my code, my understanding of how the code works or even because it is snowing outside… so I would appreciate any light you might shed on this. So, if you happen to know why it is behaving this way, I would love to hear your explanations…
The test file can be found here: Test file
Thanks a lot
Rick