Home  >  Article  >  Web Front-end  >  jCallout easily implements bubble prompt function_jquery

jCallout easily implements bubble prompt function_jquery

WBOY
WBOYOriginal
2016-05-16 17:21:441392browse

Download address of jCallout: https://github.com/anupamsmaurya/jCallout

Need to add this reference

jCallout easily implements bubble prompt function_jquery

The html code of the username line is:

Copy code The code is as follows:


Username:



Then add the following code in js:

Copy code The code is as follows:

$('#hTbxUserName').jCallout(
'initWithoutShow',{
message: "Required!",
position: "right",
backgroundColor: "#f00",
textColor: "#fff",
showEffect: "fade",
showSpeed: 300,
hideEffect: "fade",
hideSpeed: 300,
$closeElement: $('')
});

It should be noted that jCallout has two initialization methods: init and initWithoutShow. The former will display bubbles immediately after initialization, while the latter will not display immediately. Add code to display when needed:

Copy code The code is as follows:

var $userNameInput = $("#hTbxUserName");
$userNameInput.blur(function() {
if($userNameInput.val().length==0){
$userNameInput.jCallout('show');
}
});

The parameter $closeElement is to set the close button of the bubble. If you look at the plug-in source code, you will find

Copy code The code is as follows:

$closeElement: $('(X)'),

If $closeElement: $('') is not set, the following display will appear, and, Click (x) to close the bubble:

jCallout easily implements bubble prompt function_jquery

In addition, the bubble can also display pictures, just write the html code of the picture into the message parameter:

Copy code The code is as follows:

message: "Required! "

jCallout easily implements bubble prompt function_jquery

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