导航:首页 > 编程语言 > javascript鼠标特效代码

javascript鼠标特效代码

发布时间:2021-02-26 14:44:11

js代码实现鼠标移动到上面一个效果,鼠标离开效果保持

eg: jquery实现方法
你要加的样专式为属.active ul--li实现tab
$(".li").on("mouseover",function(){
$("li").removeClass("active");
$(this).addClass("active");
});

ok!!

㈡ 鼠标特效代码

尻 你会不会写代码呀?
<html>
<body>
就是写在这里拉
</body>
</html>

javascript编写的鼠标特效代码,在firefox中无法显示效果!

您好,感谢您对火狐的支持

有好几处不兼容,为您提供一个示例,简单修专改下可以属直接套用,与您设计的风格类似:http://www.csrcode.cn/html/txdm/sbtx/2050.htm。
您可以在火狐官方网站下载火狐浏览器,在火狐社区了解更多内容。希望我的回答对您有所帮助,如有疑问,欢迎继续在本平台咨询。

㈣ 求代码 html css 以及 js 效果 如图 关于鼠标点击

样式可以根据实际情况布局

外部引入的可在网上下载



<!doctypehtml>
<html>
<head>
<metacharset="utf-8">
<title>无标题文档</title>
<scriptlanguage="javascript"type="text/javascript"src="script/Marquee.js"></script>
</head>

<body>
<divclass="imgBox">
<divclass="div_leftfl"><ahref="javascript:void(0);"id="goL"><imgsrc="image/prev.jpg"/></a></div>
<divclass="div_centerfl"id="marquee1">
<ul>
<li><ahref="#"><imgsrc="image/img_03.jpg"/></a></li>
<li><ahref="#"><imgsrc="image/img_03.jpg"/></a></li>
<li><ahref="#"><imgsrc="image/img_03.jpg"/></a></li>
<li><ahref="#"><imgsrc="image/img_03.jpg"/></a></li>
<li><ahref="#"><imgsrc="image/img_03.jpg"/></a></li>
<li><ahref="#"><imgsrc="image/img_03.jpg"/></a></li>
<li><ahref="#"><imgsrc="image/img_03.jpg"/></a></li>
<li><ahref="#"><imgsrc="image/img_03.jpg"/></a></li>
<li><ahref="#"><imgsrc="image/img_03.jpg"/></a></li>
<li><ahref="#"><imgsrc="image/img_03.jpg"/></a></li>
</ul>
</div>
<divclass="div_rightfr"><ahref="javascript:void(0);"id="goR"><imgsrc="image/next.jpg"/></a></div>
<spanclass="clear_f"></span>
</div>
<script>
$(function(){
$('#marquee1').kxbdSuperMarquee({
distance:227,
time:3,
btnGo:{left:'#goL',right:'#goR'},
direction:'left'
});
});
</script>
</body>
</html>

㈤ javascript特效问题 页面上有许多点一直跟随着鼠标指针的移动。如何实现这个这个效果.

新建html复制黏贴运行即可

<html>
<head>
<title>鼠标跟随效果</title>
<style type="text/css">
html {
overflow: hidden;
}
body {
position: absolute;
height: 100%;
width: 100%;
margin:0;
padding:0;
}
#screen {
background:#000;
position: absolute;
width: 100%;
height: 100%;
}
#screen span {
background: #fff;
font-size: 0;
overflow: hidden;
width: 2px;
height: 2px;
}
</style>
<script type="text/javascript">
var Follow = function () {
var $ = function (i) {return document.getElementById(i)},
addEvent = function (o, e, f) {o.addEventListener ? o.addEventListener(e, f, false) : o.attachEvent('on'+e, function(){f.call(o)})},
OBJ = [], sp, rs, N = 0, m;
var init = function (id, config) {
this.config = config || {};
this.obj = $(id);
sp = this.config.speed || 4;
rs = this.config.animR || 1;
m = {x: $(id).offsetWidth * .5, y: $(id).offsetHeight * .5};
this.setXY();
this.start();
}
init.prototype = {
setXY : function () {
var _this = this;
addEvent(this.obj, 'mousemove', function (e) {
e = e || window.event;
m.x = e.clientX;
m.y = e.clientY;
})
},
start : function () {
var k = 180 / Math.PI, OO, o, _this = this, fn = this.config.fn;
OBJ[N++] = OO = new CObj(null, 0, 0);
for(var i=0;i<360;i+=20){
var O = OO;
for(var j=10; j<35; j+=1){
var x = fn(i, j).x,
y = fn(i, j).y;
OBJ[N++] = o = new CObj(O , x, y);
O = o;
}
}
setInterval(function() {
for (var i = 0; i < N; i++) OBJ[i].run();
}, 16);
}
}
var CObj = function (p, cx, cy) {
var obj = document.createElement("span");
this.css = obj.style;
this.css.position = "absolute";
this.css.left = "-1000px";
this.css.zIndex = 1000 - N;
document.getElementById("screen").appendChild(obj);
this.ddx = 0;
this.ddy = 0;
this.PX = 0;
this.PY = 0;
this.x = 0;
this.y = 0;
this.x0 = 0;
this.y0 = 0;
this.cx = cx;
this.cy = cy;
this.parent = p;
}
CObj.prototype.run = function () {
if (!this.parent) {
this.x0 = m.x;
this.y0 = m.y;
} else {
this.x0 = this.parent.x;
this.y0 = this.parent.y;
}
this.x = this.PX += (this.ddx += ((this.x0 - this.PX - this.ddx) + this.cx) / rs) / sp;
this.y = this.PY += (this.ddy += ((this.y0 - this.PY - this.ddy) + this.cy) / rs) / sp;
this.css.left = Math.round(this.x) + 'px';
this.css.top = Math.round(this.y) + 'px';
}
return init;
}();
</script></head>
<body>
<div id="screen"></div>
<script type="text/javascript">
new Follow('screen', {speed: 4,
animR : 2,
fn : function (i, j) {
return {
x : j/4*Math.cos(i),
y : j/4*Math.sin(i)
}
}})
</script></body>
</html>

㈥ 用javascript设计一个字符围绕鼠标特效的程序,但效果出不来,请高手指点!!!

搞定,两处报错:
1、document.write拼的字符串里有回车,不知道是不是贴到这格式引起的,可以忽略,下次要换行加个\号在前一行的末尾,代码严格些。
2、setInterval拼成了setIntercal,直接导致undefined错误。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
var word=new Array(5);
word[1]="t";word[2]="a";word[3]="n";word[4]="g";word[5]="m";
for(i=1;i<=5;i++){
document.write("<div id='word"+i+"'style='width:20px;height:20px;position:absolute;font-size:10px; visibility:hidden'><font face='Forte' color='#00ff00'>"+word[i]+"</font></div>");
}
var cx=0;
var cy=0;
function locate(){
cx=window.event.x;
cy=window.event.y;
}
document.onmousemove=locate;
function show(i){
var w=eval("word"+i);
with(w.style){
visibility="visible";
s=parseInt(fontSize);
if(s>=200)
s-=100;
else if(s>90&&s<=100){
s-=85;
clearInterval("show("+(i+1)+")",20);
}
fontSize=s;
}
}
function follow(i){
var x;
if(i<4)
x=cx-50+i*10;
else
x=cx-25+i*10;
var y=cy-20+Math.floor(Math.random()*40);
w=eval("word"+i);
with(w.style)
{
left=x.toString()+"px";
top=y.toString()+"px";
}
}
function start(){
for(i=1;i<=5;i++){
val=setInterval("show(1)",20);
setInterval("follow("+i+")",100);
}
}
start();
</script>
</head>

<body>
</body>
</html>

㈦ 一段javascript,实际上是鼠标特效,需要其于firefox并且ie中能够显示

每个浏览器就像软件一样,有自己独特的表示网页的形式,
firefox和ie,以及safari或者opera都不一样,
其中回ie最不稳定,原答因是ie允许很多插件而其他的由于
考虑到安全问题,很多都禁用了。再者
虽然在firefox和ie中显示html的语法很多都是相同的,
但是像特效这东东欲于两个浏览器中同时兼容的话,可以,
但比较复杂!建议在ie中显示就行了!祝好运

㈧ 急求各种网页鼠标特效代码(只要代码,不要网址)

很酷的跟随鼠标的三色彩带
html>
<head>
<title>网页特效|Linkweb.cn/Js|---很酷的跟随鼠标的三色彩带</title>
</head><body bgColor=#000000>
<!--将以下代码加入HTML的<Body></Body>之间-->

<script language="JavaScript">
<!--
var a_Colour='fff000';
var b_Colour='00ff00';
var c_Colour='ff00ff';
var Size=120;

var YDummy=new Array(),XDummy=new Array(),xpos=0,ypos=0,ThisStep=0;step=0.6;
if (document.layers){
window.captureEvents(Event.MOUSEMOVE);
function nsMouse(evnt){
xpos = window.pageYOffset+evnt.pageX+6;
ypos = window.pageYOffset+evnt.pageY+16;
}
window.onMouseMove = nsMouse;
}
else if (document.all)
{
function ieMouse(){
xpos = document.body.scrollLeft+event.x+6;
ypos = document.body.scrollTop+event.y+16;
}
document.onmousemove = ieMouse;
}

function swirl(){
for (i = 0; i < 3; i++)
{
YDummy[i]=ypos+Size*Math.sin((1*Math.sin((ThisStep)/10))+i*2)*Math.sin((ThisStep)/4);
XDummy[i]=xpos+Size*Math.cos((1*Math.sin((ThisStep)/10))+i*2)*Math.sin((ThisStep)/4);
}
ThisStep+=step;
setTimeout('swirl()',10);
}

var amount=10;
if (document.layers){
for (i = 0; i < amount; i++)
{
document.write('<layer name=nsa'+i+' top=0 left=0 width='+i/2+' height='+i/2+' bgcolor='+a_Colour+'></layer>');
document.write('<layer name=nsb'+i+' top=0 left=0 width='+i/2+' height='+i/2+' bgcolor='+b_Colour+'></layer>');
document.write('<layer name=nsc'+i+' top=0 left=0 width='+i/2+' height='+i/2+' bgcolor='+c_Colour+'></layer>');
}
}
else if (document.all){
document.write('<div id="ODiv" style="position:absolute;top:0px;left:0px">'
+'<div id="IDiv" style="position:relative">');
for (i = 0; i < amount; i++)
{
document.write('<div id=x style="position:absolute;top:0px;left:0px;width:'+i/2+';height:'+i/2+';background:'+a_Colour+';font-size:'+i/2+'"></div>');
document.write('<div id=y style="position:absolute;top:0px;left:0px;width:'+i/2+';height:'+i/2+';background:'+b_Colour+';font-size:'+i/2+'"></div>');
document.write('<div id=z style="position:absolute;top:0px;left:0px;width:'+i/2+';height:'+i/2+';background:'+c_Colour+';font-size:'+i/2+'"></div>');
}
document.write('</div></div>');
}
function prepos(){
var ntscp=document.layers;
var msie=document.all;
if (document.layers){
for (i = 0; i < amount; i++)
{
if (i < amount-1)
{
ntscp['nsa'+i].top=ntscp['nsa'+(i+1)].top;ntscp['nsa'+i].left=ntscp['nsa'+(i+1)].left;
ntscp['nsb'+i].top=ntscp['nsb'+(i+1)].top;ntscp['nsb'+i].left=ntscp['nsb'+(i+1)].left;
ntscp['nsc'+i].top=ntscp['nsc'+(i+1)].top;ntscp['nsc'+i].left=ntscp['nsc'+(i+1)].left;
}
else
{
ntscp['nsa'+i].top=YDummy[0];ntscp['nsa'+i].left=XDummy[0];
ntscp['nsb'+i].top=YDummy[1];ntscp['nsb'+i].left=XDummy[1];
ntscp['nsc'+i].top=YDummy[2];ntscp['nsc'+i].left=XDummy[2];
}
}
}
else if (document.all){
for (i = 0; i < amount; i++)
{
if (i < amount-1)
{
msie.x[i].style.top=msie.x[i+1].style.top;msie.x[i].style.left=msie.x[i+1].style.left;
msie.y[i].style.top=msie.y[i+1].style.top;msie.y[i].style.left=msie.y[i+1].style.left;
msie.z[i].style.top=msie.z[i+1].style.top;msie.z[i].style.left=msie.z[i+1].style.left;
}
else
{
msie.x[i].style.top=YDummy[0];msie.x[i].style.left=XDummy[0];
msie.y[i].style.top=YDummy[1];msie.y[i].style.left=XDummy[1];
msie.z[i].style.top=YDummy[2];msie.z[i].style.left=XDummy[2];
}
}
}
setTimeout("prepos()",10);
}
function Start(){
swirl(),prepos()
}
window.onload=Start;
// -->
</script>
</body></html>

跟随鼠标很逼真的弹性小球
<html>
<head>
<title>网页特效|Linkweb.cn/Js|---跟随鼠标很逼真的弹性小球</title>
</head><body>
<!--将以下代码加入HTML的<Body></Body>之间-->

<DIV id=dot0
style="HEIGHT: 16; POSITION: absolute; VISIBILITY: hidden; WIDTH: 11; left:10; top:15"><IMG
height=11 src="images/bullet.gif" width=11> </DIV>
<DIV id=dot1 style="HEIGHT: 11px; POSITION: absolute; WIDTH: 11px"><IMG
height=11 src="images/bullet.gif" width=11> </DIV>
<DIV id=dot2 style="HEIGHT: 11px; POSITION: absolute; WIDTH: 11px"><IMG
height=11 src="images/bullet.gif" width=11> </DIV>
<DIV id=dot3 style="HEIGHT: 11px; POSITION: absolute; WIDTH: 11px"><IMG
height=11 src="images/bullet.gif" width=11> </DIV>
<DIV id=dot4 style="HEIGHT: 11px; POSITION: absolute; WIDTH: 11px"><IMG
height=11 src="images/bullet.gif" width=11> </DIV>
<DIV id=dot5 style="HEIGHT: 11px; POSITION: absolute; WIDTH: 11px"><IMG
height=11 src="images/bullet.gif" width=11> </DIV>
<DIV id=dot6 style="HEIGHT: 16; POSITION: absolute; WIDTH: 11; left:10; top:15"><IMG
height=11 src="images/bullet.gif" width=11> </DIV>
<SCRIPT language=JavaScript>
var nDots = 7;
var Xpos = 0;
var Ypos = 0;
var DELTAT = .01;
var SEGLEN = 10;
var SPRINGK = 10;
var MASS = 1;
var XGRAVITY = 0;
var YGRAVITY = 50;
var RESISTANCE = 10;
var STOPVEL = 0.1;
var STOPACC = 0.1;
var DOTSIZE = 11;
var BOUNCE = 0.75;
var isNetscape = navigator.appName=="Netscape";
var followmouse = true;
var dots = new Array();
init();
function init()
{
var i = 0;
for (i = 0; i < nDots; i++) {
dots[i] = new dot(i);
}

if (!isNetscape) {
}
for (i = 0; i < nDots; i++) {
dots[i].obj.left = dots[i].X;
dots[i].obj.top = dots[i].Y;
}
if (isNetscape) {
startanimate();
} else {
setTimeout("startanimate()", 1000);
}
}
function dot(i)
{
this.X = Xpos;
this.Y = Ypos;
this.dx = 0;
this.dy = 0;
if (isNetscape) {
this.obj = eval("document.dot" + i);
} else {
this.obj = eval("dot" + i + ".style");
}
}
function startanimate() {
setInterval("animate()", 20);
}
function setInitPositions(dots)
{
var startloc = document.all.tags("LI");
var i = 0;
for (i = 0; i < startloc.length && i < (nDots - 1); i++) {
dots[i+1].X = startloc[i].offsetLeft
startloc[i].offsetParent.offsetLeft - DOTSIZE;
dots[i+1].Y = startloc[i].offsetTop +
startloc[i].offsetParent.offsetTop + 2*DOTSIZE;
}
dots[0].X = dots[1].X;
dots[0].Y = dots[1].Y - SEGLEN;
}
function MoveHandler(e)
{
Xpos = e.pageX;
Ypos = e.pageY;
return true;
}
function MoveHandlerIE() {
Xpos = window.event.x + document.body.scrollLeft;
Ypos = window.event.y + document.body.scrollTop;
}

if (isNetscape) {
document.captureEvents(Event.MOUSEMOVE);
document.onMouseMove = MoveHandler;
} else {
document.onmousemove = MoveHandlerIE;
}

function vec(X, Y)
{
this.X = X;
this.Y = Y;
}
function springForce(i, j, spring)
{
var dx = (dots[i].X - dots[j].X);
var dy = (dots[i].Y - dots[j].Y);
var len = Math.sqrt(dx*dx + dy*dy);
if (len > SEGLEN) {
var springF = SPRINGK * (len - SEGLEN);
spring.X += (dx / len) * springF;
spring.Y += (dy / len) * springF;
}
}
function animate() {
var start = 0;
if (followmouse) {
dots[0].X = Xpos;
dots[0].Y = Ypos;
start = 1;
}
for (i = start ; i < nDots; i++ ) {

var spring = new vec(0, 0);
if (i > 0) {
springForce(i-1, i, spring);
}
if (i < (nDots - 1)) {
springForce(i+1, i, spring);
}
var resist = new vec(-dots[i].dx * RESISTANCE,
-dots[i].dy * RESISTANCE);
var accel = new vec((spring.X + resist.X)/MASS + XGRAVITY,
(spring.Y + resist.Y)/ MASS + YGRAVITY);
dots[i].dx += (DELTAT * accel.X);
dots[i].dy += (DELTAT * accel.Y);
if (Math.abs(dots[i].dx) < STOPVEL &&
Math.abs(dots[i].dy) < STOPVEL &&
Math.abs(accel.X) < STOPACC &&
Math.abs(accel.Y) < STOPACC) {
dots[i].dx = 0;
dots[i].dy = 0;
}
dots[i].X += dots[i].dx;
dots[i].Y += dots[i].dy;
var height, width;
if (isNetscape) {
height = window.innerHeight + window.pageYOffset;
width = window.innerWidth + window.pageXOffset;
} else {
height = document.body.clientHeight + document.body.scrollTop;
width = document.body.clientWidth + document.body.scrollLeft;
}
if (dots[i].Y >= height - DOTSIZE - 1) {
if (dots[i].dy > 0) {
dots[i].dy = BOUNCE * -dots[i].dy;
}
dots[i].Y = height - DOTSIZE - 1;
}
if (dots[i].X >= width - DOTSIZE) {
if (dots[i].dx > 0) {
dots[i].dx = BOUNCE * -dots[i].dx;
}
dots[i].X = width - DOTSIZE - 1;
}
if (dots[i].X < 0) {
if (dots[i].dx < 0) {
dots[i].dx = BOUNCE * -dots[i].dx;
}
dots[i].X = 0;
}
dots[i].obj.left = dots[i].X;
dots[i].obj.top = dots[i].Y;
}
}
</SCRIPT>

</body></html>

这里太小了 放不了那么多
http://www.jscode.cn/jave_mouse/29051032.htm
里面有很多的 不想链接的话 就看那两个吧

㈨ JS鼠标滑动特效和HTML的a:hover之类的 那个好些

纠正制LZ
1.a:什么的 叫css 超链接伪类
2.a:visiter后面是D,指访问过的。
解释:
a:link超链接未被访问(默认)状态,
a:hover鼠标滑过超链接的状态
a:visited已访问过的链接的样式(默认是紫色)

回答问题
从代码来说,css要简单点;
毕竟css是现成的代码,做起来要省力许多,而且看起来方便,便于维护。

js代码一是多,复杂,if elseif 的太多了乱 不容易恢复 不好维护。

建议LZ再重温下css伪类的知识。

ps.在有些时候,css的代码也可能会变得复杂js反而会简单,请根据实际情况来定。

㈩ 请教网页设计高手鼠标特效代码代码求大神帮助

鼠标移上去就打开页面: 第一步:把如下代码加入<body>区域中 <SCRIPT Language="JavaScript">function winopen () {msg=open("update.htm","NewWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,history=yes,width=400,height=260");}</SCRIPT> 第二步:把如下代码加内入<body>区域中 <a href="链接地址容" onMouseOver="winopen(); return true;"><IMG SRC="shu.gif" border="0"></a> 自动跳转的话这个度试看 <a href=" 链接地址" onMouseOver="指定页面"><IMG SRC="shu.gif" border="0"></a> 不行的话加我Q吧 我这个只是理论的写写 没实现过 你试试看吧

满意请采纳

阅读全文

与javascript鼠标特效代码相关的资料

热点内容
api接口版本控制 浏览:579
iphone拍出虚焦 浏览:163
微信里的文件怎么打开 浏览:653
炫舞空白印象代码 浏览:345
维修用什么编程器好 浏览:824
新建压缩文件夹没了 浏览:700
阳西哪里招文件管理 浏览:324
腾讯文档目录文件名 浏览:509
编程指令s1s2q指的是什么 浏览:205
快手下载安卓电视版 浏览:811
有哪些app可以搜大学 浏览:972
linux命令行连wifi 浏览:630
微信公众账号新年红包 浏览:656
mfcsocket编程教程 浏览:461
乐动力苹果版 浏览:54
qq怎么帮别人充q币 浏览:276
linux内存分配机制 浏览:454
惆怅qq表情 浏览:206
古城区网站搭建多少钱 浏览:64
st7565液晶12864串行程序 浏览:477

友情链接