Reason for writing:
As a cue box, jquery has a MessageBox control, which is the popup prompt box. However, if this control is not used when it is necessary to confirm the warning, message prompt, failure prompt, the user also needs to go to the point of confirmation, sometimes this operation is very annoying (although you can set timeout, will automatically disappear).
Control requirements:
Now you need a simple message prompt control, no need to confirm.
1. The Tip box can slide in from the top or bottom and slide out after failure.
2. You can set the slide in time, content dwell time, slide out time.
PS: Relatively simple controls
The effect is as follows
Writing process:
1. In the absence of documentation, I recommend that you write the definition of the parameter that the user can pass to the front of the control.
var defaults = { 9999 , 1, //second contenttimeout:3 , 1, "Top" //show position top or bottom };
This allows the user to be able to set up the very clear, even if there is no document, but also happy to play.
2. Consider browser compatibility
Because the control's cue box is fixed at the bottom or top, it's inevitable that position:fixed is the problem
IE6 IE7 IE8 fixed positioning element Position:absolute with settings, so the location calculation will also change.
3. The implementation of the sliding effect
Slide in, content stays, slide out.
The specific implementation is not explained here, the final side will have the source link.
PS: The main thing is the above three.
Summarize:
1. In the era of emphasis on user experience, this control is also for the user to have a better feeling.
2. When doing something (coding), also always want to whether this thing can be universal, and the control and framework is nothing more than universal.
3. Also attach the download link for my control
Click Download, Jquery.messagetip