I use the excellent BeautyTips plugin as a means of indicating end-user verification errors, and I run into positioning problems every time the content of the page is dynamically added, deleted, or animated.
Here is a concrete example. I have a DIV at the top of each page, which is used for confirmation / error messages. It appears in $ (document.ready) using slideToggle (). This naturally pushes all subsequent html content down, discarding the location / alignment of the beauties. If I call the built-in plugin update method after the slideToggle () function is started, positioning problems are fixed. You can see previous / subsequent screenshots here and here .
One possible way to solve the problem would be to programmatically detect DOM changes, in particular css changes, so that I can then iterate over each dye and manually reload it. However, there seems to be no built-in jQuery events that expose such functionality. I saw an impressive jQuery plugin from Rick Strahlwhich tracks CSS changes, but it seems to be based on the assumption that someone knows ahead of time the time during which certain HTML elements (s) that they want to control. I want to track the entire document, since I do not expect to find out what html elements can exist on this page: a) they will be animated and b) will be in such a position in the document that they will "click" down on my beauties " And I, of course, do not want you to face a huge performance hit when polling every block-level element in a document.
I should mention that the plugin works great if I use it in the default “freeze” mode, in which the beauties are displayed only in response to the user mouse input. Unfortunately, for an application that states that all validation errors should be displayed after the form is submitted without additional user interaction, there is a design restriction.
I am sure there is a really simple / elegant solution that completely eludes me. Of course, I could have avoided all this hassle by simply not using animation to display the contents of the page, but that seems like a high price.
source
share