


javascript practical text chain prompt box effect_text special effects
The effect should basically realize the following functions:
(1) When the mouse slides over the link text in the article, a prompt box will pop up at the corresponding position. The style of the prompt box is controlled by CSS and is highly adaptive; the mouse can click on the middle of the prompt box The link will automatically disappear when you slide away from the prompt box;
(2) Control the position of the prompt box within the text field. If the link text is on the left side of the text field, the prompt box should be displayed on the right, so that It will not leave the text field; on the contrary, if the link text is on the right side of the text field, the prompt box should be displayed on the left;
(3) If the text field has a lot of content and the link text happens to be at the bottom of the browser, in order to make the prompt The box should not leave the visible range of the browser, and the position of the prompt box should be automatically adjusted above the link text;
1.css
.main{width:950px; border:#9C3 1px solid; margin:0 auto; padding:15px; background-color:# fff; line-height:25px;font-size:14px; position:relative;}
span{border:#70bce4 2px solid; display:block; position:absolute; background-color:#FFF; padding:5px 10px ; font-size:12px; width:200px; display:none;}
.cur{color:#900;}
2.js
//Function to get object elements;
function $a(id,tag){var re =(id&&typeof id!="string")?id:document.getElementById(id);if(!tag){return re;}else{return re.getElementsByTagName(tag);}}
function tips(){
//Get the list of a elements in the text field;
var article=$a("article","a")
for(i=0;i
if(article[i].className.indexOf("cur")==-1) continue;
article[i].onmouseover=function(e){
//Get the coordinates of the mouse pointer in the browser's visible area, not affected by the document content;
var e=e||event;
posX = e.clientX;
posY = e.clientY;
//Get the height of the browser’s visible area;
var bodyhe=document.documentElement.clientHeight;
var parwidth=$a ("article").offsetWidth;
var tipbox=get_nextSibling(this);
var boxlist=$a("article","span")
//Set the span tip box in the text area It is hidden state;
for(j=0;j
boxlist[j].innerHTML=" Enter background data"
}
//Set the current tip box display;
tipbox.style.display="block";
var w=tipbox.offsetWidth-this.offsetWidth;
/*
The div with the id as article has relative positioning: relative added, so it is already the parent of the tip box;
Control the display position of the pop-up box;
*/
tipbox.style .left=(this.offsetLeft>parwidth/2?this.offsetLeft-w:this.offsetLeft) "px";
tipbox.style.top=(posY tipbox.offsetHeight>bodyhe?this.offsetTop-tipbox.offsetHeight :document.all?this.offsetTop 15:this.offsetTop this.offsetHeight) "px";
tipbox.onmouseover=function(){this.style.display="block";}
tipbox.onmouseout= this.onmouseout=function(){tipbox.style.display="none";}
}
}
}
//Get the next label node of the object element;
function get_nextSibling (n){
var x=n.nextSibling;
while (x.nodeType!=1){
x=x.nextSibling;
}
return x;
}
Friends who are interested in posting the source file code can test it. If you have any questions, please leave a message@&@
< br />
Double-fire gun Shanghai starts up
Double-fire cannon starts up in Shanghai My ambiguous attitude also added to the mystery of this incident. Long before the Edison Chen "pornographic photo scandal" broke out, Edison Chen's father was rumored to be supporting mainland actor Hu Bing. As the saying goes, there is no smoke without fire. The two were once photographed by the media eating and shopping together. AndHu BingDouble-fire gun Shanghai starts
Double-fire gun Shanghai starts up
Double-fire cannon starts up in Shanghai My ambiguous attitude also added to the mystery of this incident. Long before the Edison Chen "pornographic photo scandal" broke out, Edison Chen's father was rumored to be supporting mainland actor Hu Bing. As the saying goes, there is no smoke without fire. The two were once photographed by the media eating and shopping together. AndHu BingDouble-fire gun Shanghai starts
Double-fire gun Shanghai starts up
Double-fire cannon starts up in Shanghai My ambiguous attitude also added to the mystery of this incident.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Article discusses creating, publishing, and maintaining JavaScript libraries, focusing on planning, development, testing, documentation, and promotion strategies.

The article discusses strategies for optimizing JavaScript performance in browsers, focusing on reducing execution time and minimizing impact on page load speed.

Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

The article discusses effective JavaScript debugging using browser developer tools, focusing on setting breakpoints, using the console, and analyzing performance.

The article explains how to use source maps to debug minified JavaScript by mapping it back to the original code. It discusses enabling source maps, setting breakpoints, and using tools like Chrome DevTools and Webpack.

This article explores effective use of Java's Collections Framework. It emphasizes choosing appropriate collections (List, Set, Map, Queue) based on data structure, performance needs, and thread safety. Optimizing collection usage through efficient

Once you have mastered the entry-level TypeScript tutorial, you should be able to write your own code in an IDE that supports TypeScript and compile it into JavaScript. This tutorial will dive into various data types in TypeScript. JavaScript has seven data types: Null, Undefined, Boolean, Number, String, Symbol (introduced by ES6) and Object. TypeScript defines more types on this basis, and this tutorial will cover all of them in detail. Null data type Like JavaScript, null in TypeScript

This tutorial will explain how to create pie, ring, and bubble charts using Chart.js. Previously, we have learned four chart types of Chart.js: line chart and bar chart (tutorial 2), as well as radar chart and polar region chart (tutorial 3). Create pie and ring charts Pie charts and ring charts are ideal for showing the proportions of a whole that is divided into different parts. For example, a pie chart can be used to show the percentage of male lions, female lions and young lions in a safari, or the percentage of votes that different candidates receive in the election. Pie charts are only suitable for comparing single parameters or datasets. It should be noted that the pie chart cannot draw entities with zero value because the angle of the fan in the pie chart depends on the numerical size of the data point. This means any entity with zero proportion
