Quick Web Development Guide – Awesomeness Tooltip Plugin
Awesomeness Tooltip Plugin
One of the great tools we have in our web development goodie-bag are tooltips. A tooltip is a box that appears when you hover your cursor over an element like a hyperlink. It provides supplementary information about that element. For example, a link with little or no text (an icon) may become confusing. Provide an extra sentence or two within a tooltip to explain to your users what will happen if they click on it.
Tooltip Plugin Features
- Cross Browsers
- Easy Positioning
- Rounded Corners
- Scripting API
- Custom Effects
Complete Web Development Guide – Users Need to Know
First, You Must be Creative
You need to open Photoshop or your software option and flog up an amazing impression tooltip. In spite of it designing on a transparent background, this can help users to drag up users’ tooltip at the background alike to that of users’ site. In that, style it will make mixture impeccably, for a large portion it has no particular way for step completion. Just concentrate upon your creativity and imagination.
Slice and Dice Your Tooltip
For this specific design, one will require to slice the tooltip into 3 multiple images. The specific design will require a PNG to hold transparency.
- The acme piece
- A small 1 pixel slice that will revise vertically in the center
- The bottom piece.
- In the 4th portion one can see three pieces after they were cut out. One can put these image files into specific folder named “images”.
Write the HTML/CSS Markup
When the images are sliced, one can move to the HTML and CSS markup. This is the easiest part.
- “tipMid” will ultimately grasp the text that the tooltip will present. This will also have tipMid.png revising perpendicularly inside it.
- “tipBtm” is a single for display at the bottom of the tooltip, tipBtm.png.
- Inside of index.html, it includes a group of loaded text and some other factors with their title features filled out.
The CSS deployed for this tooltip is no doubt elegant, just includes some supportive style.
Why a Plugin?
jQuery is absolutely pretty and cool by itself. However, the real thrill is in enhancing with a plugin. When some places its code into a plugin, one can reuse it. This is the reason one can create up a code library and never try to write same code two times.
Write the Plugin
Users must know the style of coding, for work start you need to create a ,js file and give it name of jquery.betterTooltip.js so may you can make it yielding with jQuery plugin standards. This boosts up a public function that can be cited from the top of a document or one more external .js file. To call for your plugin users need to follow a line.
Reveal the Plugin Settings
With a purpose to thwart having to change the plugin for all projects this is significant to reveal some of the variables as well as settings so may they can be twisted from external side of plugin itself. The final purpose will be to never sync with the plugin just manage the settings.
The $(this).each function
This is the most significant aspect of jQuery plugin. The $(this).each function disk via every page factor that is linked with the plugin when it was tweeted. In such situation all elements concerned with the “tTip” class. This is amazingly simple, the top half contains upon a group of properties for the x & y position, width, height and even the small feature value of the
This is fairly “tTip” elements. I’m using the jQuery offset() CSS method to grab the top and left position. Another significant part of the $(this).each function is stylish line of code here that erases the small attributes.
Delay the Fade-in Animation of the Tooltip
Two methods StopTimer and SetTimer are employed to manage a delay from the time when users move their cursor at the element with the “tTip” class and at times when tooltip makes it visible.
Position the Tooltip
The moving function inside the $(this).each loop, it was developed before calls setTip(). The basic purpose is to place the position the whole tooltip straight to “tTip” element. This all is done before the fade-in animation.
Tooltip Fade-in Animation
Last but not least, the showTip() function. It stands with jQuery’s animate() UI effect to lighten the tooltip.