Compile a simple jQuery prompt plug-in and a jquery plug-in
Very simple code.
Code:
Copy codeThe Code is as follows:
/**
* March November 13, 2014
* Prompt plug-in
*/
(Function ($ ){
$. Fn. tips = function (text ){
Var divtipsstyle = "position: absolute; left: 0; top: 0; background-color: # dceaf2; padding: 3px; border: solid 1px #6dbde4; visibility: hidden; line-height: 20px ;";
$ ("Body "). append ("<div class = 'div-tids' style = '" + divtipsstyle + "'>" + text + "</div> ");
Var divtips = $ (". div-tips ");
Divtips.css ("visibility", "visible ");
Var top = this. offset (). top-divtips. height ()-8;
Var left = this. offset (). left;
Divtips.css ("top", top );
Divtips.css ("left", left );
$ (Document). mousemove (function (e ){
Var top = e. clientY + $ (window). scrollTop ()-divtips. height ()-12;
Var left = e. clientX;
Divtips.css ("top", top );
Divtips.css ("left", left );
});
};
$. Fn. removetips = function (text ){
$ (". Div-tips"). remove ();
};
}) ($ );
(Move the cursor over the product and a square product details box is displayed below ):
It's very practical. Let's make full use of it and integrate it into your own projects.