Home >Web Front-end >JS Tutorial >Form JS pop-up prompt effect code_form effects

Form JS pop-up prompt effect code_form effects

WBOY
WBOYOriginal
2016-05-16 18:07:341137browse

HTML

Copy code The code is as follows:





/form>

Styles in the page

Copy code The code is as follows:


Key JS

Copy code The code is as follows:
$(function() {
$(".input ,.login_input,.textarea").focus(function() {
$(this).addClass("focus");
}).blur(function() {
$(this). removeClass("focus");
});
//Input box prompt, get the object with HintTitle, HintInfo properties
$("[HintTitle],[HintInfo]").focus(function( event) {
$("*").stop(); //Stop all running animations
$("#HintMsg").remove(); //Clear first to prevent repeated errors
var HintHtml = "
  • " $(this). attr("HintTitle") "" $(this).attr("HintInfo") "
"; //Set the displayed content
var offset = $(this).offset(); //Get the position of the event object
$("body").append(HintHtml); //Add node
$("#HintMsg").fadeTo(0, 0.85); //Transparency of the object
var HintHeight = $("#HintMsg").height(); //Get the container height
$( "#HintMsg").css({ "top": offset.top - HintHeight "px", "left": offset.left "px" }).fadeIn(500);
}).blur(function( event) {
$("#HintMsg").remove(); //Delete UL
});
});


Rendering:

Form JS pop-up prompt effect code_form effects

The above content comes from a download website, the specific name has been forgotten....it is for reference only

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn