2 Star 0 Fork 1

尹智山/yinzhishanPersonal web page

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
home.js 2.83 KB
一键复制 编辑 原始数据 按行查看 历史
yinzhishan 提交于 2016-06-29 15:33 . 静态页面完成
/**
* Created by Administrator on 2016/6/13.
*/
$(function (){
$(window).load(function (){
$('#zhuti').css({
margin: 0 +'px auto',
opacity: 1
});
});
$('#head ul li').eq(2).hover(function (){
$('#head ul li b').css({transform:"rotate(90deg)"});
$(this).css({height:'110px'});
},function (){
$('#head ul li b').css({transform:"rotate(0deg)"});
$(this).css({height: "20px"});
});
//登录框弹出事件
$('.goin').click(function (){
$('body').css('overflow', 'hidden');
$('.masking').css({
height: $(document).height() + 'px',
display:'block'});
$(' .ring').css({display:'block'});
});
//关注弹出事件
$('#head li div p').each(function (index){
$(this).click(function (){
$('body').css('overflow', 'hidden');
$(' .attention img').attr('src','../img/'+index+'.jpg');
$('.masking').css({
height: $(document).height() + 'px',
display:'block'});
$(' .attention').css({display:'block'});
return false;
})
});
//关闭弹出层
$('.close').each(function (){
$(this).click(function (){
$('body').css('overflow', 'auto');
$('.masking').css({display:'none'});
$(' .ring').css({display:'none'});
$(' .attention').css({display:'none'});
});
});
// 点击触发移动事件
$('.move').mousedown(function (e){
// console.log(e.clientX);//鼠标在视图中的位置
// console.log($('.goin').position().top);//元素的位置
var pointX = e.clientX + 175 - $('.ring').position().left;
// console.log(pointX);
var pointY = e.clientY + 200 - $('.ring').position().top;
// console.log(pointY);
// 移动事件
$('.move').mousemove(function (e){
var X = e.clientX - pointX + 175;
var Y = e.clientY - pointY + 200;
// 判断是否出了视图了
if (X<175){X=175}
if (X>$(window).width()-$(this).width() + 100){X=$(window).width()-$(this).width() +100}
if (Y<200){Y=200}
// console.log($(document).scrollTop());
// console.log($('.goin').position().top);
// console.log($('.goin').height());
// if (Y>$(window).height()-$('.ring').height() + 200){Y=$(window).height()-$('.goin').height() + 200}
$('.ring').css({
top: Y + 'px',
left: X + 'px'
});
});
// 移出和松开鼠标时清除移动事件
}).mouseup(function (){
$(this).unbind('mousemove');
}).mouseout(function (){
$(this).unbind('mousemove');
});
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/webh5/yinzhishanPersonal-web-page.git
git@gitee.com:webh5/yinzhishanPersonal-web-page.git
webh5
yinzhishanPersonal-web-page
yinzhishanPersonal web page
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385