2010 Mar 21

jBubble Tooltip jQuery Plugin

Introduction

An easy to use tooltip plugin of jQuery. You can skin it by modifying its css file and control its behaviors through many methods.

Demo

You can find a live demo here: http://pagetalks.com/share/jBubble/.

一个简单易用的提示条插件。你可以通过CSS来改变其外观,并通过多种方式来控制其行为。

演示

你可以在次处找到在线演示: http://pagetalks.com/share/jBubble/.


Download

  jBubble.zip (6.0 KiB, 387 hits)

Markups

<a href="#" id="a" title="this title cannot be ommitted!">Come on, find out what i can tell you!</a>

By default, the content of tooltip is taken from title attribute.

Installation

  1. Include juqery.bubble.js and bubble.css
  2. Call it after DOM Ready, e.g:
    $(".tooltip").bubble();

By default, it will listen for mouseover event to show tooltip.

Parameters

data_src (String)
Default : “title” – a propertity name that the plugin will find content for tooltip in.
alone (boolean)
Default: true – if only one tooltip is allowed to display at the same time
once (boolean)
Default: false - if the tooltip only shows up once.
Usualy, you directly pass a boolean value rather a parameter object. e.g, when #d is clicked, #c will show its tooltip without initialization.

$("#d").click(function() {
		$("#c").bubble(true);
		});

Public Methods

$.fn.showBubble
after initialzed by $.fn.bubble, you can manually invoke the tooltip by this method. e.g.

	$("#a").bubble();
	$("#b").click(function() {
		$("#a").showBubble();
	});
	
$.fn.clearBubble
clear the bubble effect on certain elements

Changelog

1.0
First Release of jBubble Plugin

下载

  jBubble.zip (6.0 KiB, 387 hits)

HTML代码

<a href="#" id="a" title="this title cannot be ommitted!">Come on, find out what i can tell you!</a>

默认情况下,该插件把title属性的内容当作提示条的内容

安装

  1. 引入juqery.bubble.js和bubble.css
  2. DOM Ready事件后调用, 例如:
    $(".tooltip").bubble();

默认情况下,该插件会监听指定元素的mouseover事件并恰时显示提示条。

参数

data_src (String)
默认 : "title" - 提示条内容的数据源。这应该是元素的一个属性名。
alone (boolean)
默认: true - 是否在同一时刻只能显示一个提示条
once (boolean)
默认: false - 是否只显示一遍。为使用这个参数,应该直接将一个布尔值传入$.fn.bubble方法,而不是传递一个包含参数的对象:

$("#d").click(function() {
		$("#c").bubble(true);
		});

公用方法

$.fn.showBubble
在初始化后,手工激发工具条的显示,例如:

	$("#a").bubble();
	$("#b").click(function() {
		$("#a").showBubble();
	});
	
$.fn.clearBubble
清除指定元素的工具条显示

更新日志

1.0
jBubble插件的初次发行

Post a Comment

Your email is never shared. Required fields are marked *

*
*