JS框架_(JQuery.js)动画效果鼠标跟随
2023-09-14 08:57:05 时间
百度云盘 传送门 密码 :4n9u
火狐浏览器上纯CSS_动画效果鼠标跟随效果:
(作者:lily_lcj 传送门)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!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> <link rel="stylesheet" href="css/public.css" /> <link rel="stylesheet" href="css/style.css" /> <script type="text/javascript" src="scripts/respond.js"></script><!-- IE下兼容@media screen --> <script type="text/javascript" src="scripts/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="scripts/sketch.min.js"></script> </head> <body> <p>Gary</p> <!-- 鼠标跟随DIV --> <div id="test" style="position:fixed;top:0px;z-index:20;"></div> <script language="JavaScript"> function getOs(){ var OsObject = ""; if(navigator.userAgent.indexOf("MSIE")>0) { return "MSIE"; } if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ $.getScript('scripts/mousefollow.js'); return "Firefox"; } if(isSafari=navigator.userAgent.indexOf("Safari")>0) { $.getScript('scripts/mousefollow.js'); return "Safari"; } if(isCamino=navigator.userAgent.indexOf("Camino")>0){ $.getScript('scripts/mousefollow.js'); return "Camino"; } if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ $.getScript('scripts/mousefollow.js'); return "Gecko"; } } getOs(); </script> </body> </html>
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
@charset "utf-8";
/* CSS Document */
/*==============================
CSS RESET
================================= */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td{
margin: 0;
padding: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
font-family:"Microsoft YaHei","SimHei";
font-size:12px;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
content: '';
content: none;
}
:focus {
outline: 0;
}
ins {
text-decoration: none;
}
del {
text-decoration: line-through;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {
display: inline-block;
}
/* Hide from IE Mac \*/
.clearfix{
display: block;
}
/* End hide from IE Mac */
.none {
display: none;
}
a{text-decoration:none;}
input{ -webkit-box-sizing:border-box;
-webkit-appearance: none;
}
/* End Clearfix */
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
@charset "utf-8";
/* CSS Document */
body{background:#222;}
.border_left_none{border-left:0px!important;}
#index_top img{
float:left;
height:15px;
margin-top:10px;
/*border-top:1px solid yellow;
border-bottom:1px solid yellow;*/
padding:5px;
margin-right:20px;
}
#index_top p{
color:#fff;
line-height:15px;
margin-top:15px;
float:left;
font-size:14px;
font-weight:700;
padding-left:20px;
padding-right:20px;
border-left:1px solid #fff;
}
@media screen and (min-width: 1200px){
.top_wrap{
width:1180px;
height:45px;
margin:0 auto;
}
}
@media screen and (min-width: 960px) and (max-width: 1199px){
.top_wrap{
width:960px;
height:45px;
margin:0 auto;
}
}
p {
position: fixed;
top: 50%;
left: 0;
right: 0;
text-align: center;
transform: translateY(-50%);
font-size: 40px;
font-weight: 900;
color: white;
text-shadow: 0 0 50px black;
text-transform: capitalize;
font-family: 'Roboto','Helvetica','Arial',sans-serif;
letter-spacing: 5px;
}
实现效果
getOs()获取浏览器种类,绑定js
<script language="JavaScript"> function getOs(){ var OsObject = ""; if(navigator.userAgent.indexOf("MSIE")>0) { return "MSIE"; } if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ $.getScript('scripts/mousefollow.js'); return "Firefox"; } if(isSafari=navigator.userAgent.indexOf("Safari")>0) { $.getScript('scripts/mousefollow.js'); return "Safari"; } if(isCamino=navigator.userAgent.indexOf("Camino")>0){ $.getScript('scripts/mousefollow.js'); return "Camino"; } if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ $.getScript('scripts/mousefollow.js'); return "Gecko"; } } getOs(); </script>
window.navigator.userAgent.indexOf()获取浏览器类型和版本号的
支持:MSIE、Firefox、Safari、Camino、Gecko类型浏览器
以后等我厉害了一定要弄个兼容全部浏览器的O(∩_∩)O~
相关文章
- js动画效果大全_jquery 动画
- 【说站】js中事件捕获的实现
- 【说站】js作用域链中的对象访问顺序
- jquery validation engine ajax验证,jQuery Validation Engine 表单验证「建议收藏」
- 如何使用jscythe并通过Node.js的Inspector机制执行任意JS代码
- jQuery图片切换插件jquery.cycle.js详解编程语言
- jQuery ready和JS onload事件的区别
- 创建JS文件:在Linux下实现自动化任务(linux创建js文件)
- 快速掌握JS操作MySQL数据库技巧(js操作mysql数据库)
- 百度留言本js大家可以参考下
- JQuery,Extjs,YUI,Prototype,Dojo等JS框架的区别和应用场景简述
- js+css使DIV始终居于屏幕中间左下左上右上右下的代码集合
- js与jquery中获取当前鼠标的x、y坐标位置的代码
- JQuery的read函数与js的onload不同方式实现
- JS/jQuery实现默认显示部分文字点击按钮显示全部内容
- 一个js控制的导航菜单实例代码
- 在js文件中写el表达式取不到值的原因及解决方法
- js与jquery获取父级元素,子级元素,兄弟元素的实现方法
- js获取元素下面所有li的两种方法
- JS判断、校验MAC地址的2个实例
- js设置缓存及获取设置的缓存
- js、jquery图片动画、动态切换示例代码