/*
*作者木木
*
*http://www.dao-gu.com
*/
//右键菜单
jQuery(document).ready(function ($) {
$("#vanvan").mousedown(function (e) {
if(e.which==3){
//showMessage("秘密通道:
首页 留言 后台 ",10000);
}
});
$("#vanvan").bind("contextmenu", function(e) {
return false;
});
});
//鼠标在消息上时
jQuery(document).ready(function ($) {
$("#message").hover(function () {
$("#message").fadeTo("100", 1);
});
});
//鼠标在上方时
jQuery(document).ready(function ($) {
//$(".mumu").jrumble({rangeX: 2,rangeY: 2,rangeRot: 1});
$(".mumu").mouseover(function () {
/*$(".mumu").fadeTo("300", 0.3);*/
msgs = ["不要觉得我可爱,就不放开我,我会一直隐身哦!", "你助我“一击”之力,我陪你飞向云端↑↑↑", "HELLO,候你多时,一起乘飞机,逃脱地心引力……"];
var i = Math.floor(Math.random() * msgs.length);
showMessage(msgs[i]);
});
$(".mumu").mouseout(function () {
$(".mumu").fadeTo("300", 1)
});
});
//开始
jQuery(document).ready(function ($) {
if (isindex) { //如果是主页
var now = (new Date()).getHours();
if (now > 0 && now <= 6) {
showMessage(visitor + ' 你是夜猫子呀?还不睡觉,明天起得来么你?', 6000);
} else if (now > 6 && now <= 11) {
showMessage(visitor + ' 早安,朋友,萌萌的我,陪你开启美美的一天~~~', 6000);
} else if (now > 11 && now <= 14) {
showMessage(visitor + ' 中午了,吃饭了么?不要饿着了,饿死了谁来挺我呀!', 6000);
} else if (now > 14 && now <= 18) {
showMessage(visitor + ' 下午的时光真难熬!还好有你在!', 6000);
} else {
showMessage(visitor + ' 快来逗我玩吧!', 6000);
}
}
else {
showMessage('欢迎' + visitor + '来到欢乐秀 ' + title + ' ', 6000);
}
$(".vanvan").animate({
top: $(".vanvan").offset().top + 0,
left: document.body.offsetWidth - 160
},
{
queue: false,
duration: 1000
});
});
//无聊讲点什么
/*jQuery(document).ready(function ($) {
window.setInterval(function () {
msgs = ["陪我聊天吧!", "好无聊哦,你都不陪我玩!", "…@……!………", "^%#&*!@*()(!)(", "我可爱吧!嘻嘻!~^_^!~~","谁淫荡呀?~谁淫荡?,你淫荡呀!~~你淫荡!~~","从前有座山,山上有座庙,庙里有个老和尚给小和尚讲故事,讲:“从前有座……”"];
var i = Math.floor(Math.random() * msgs.length);
showMessage(msgs[i], 10000);
}, 35000);
});*/
var spig_top = 50;
//滚动条移动
jQuery(document).ready(function ($) {
var f = $(".vanvan").offset().top;
$(window).scroll(function () {
$(".vanvan").animate({
top: $(window).scrollTop() + f +0
},
{
queue: false,
duration: 1000
});
});
});
//对浏览器窗口调整
jQuery(document).ready(function ($) {
var f = $(".vanvan").offset().top;
console.log(f);
console.log($(".vanvan").offset().top);
console.log(document.body.offsetWidth);
$(window).resize(function () {
$(".vanvan").animate({
top: $(".vanvan").offset().top + 0,
left: document.body.offsetWidth - 160
},
{
queue: false,
duration: 1000
});
});
});
//显示消息函数
function showMessage(a, b) {
if (b == null) b = 5000;
//jQuery("#message").hide();
jQuery("#message").hide().stop();
jQuery("#message").html(a);
jQuery("#message").fadeIn();
jQuery("#message").fadeTo("1", 1);
jQuery("#message").fadeOut(b);
};
//拖动
var _move = false;
var ismove = false; //移动标记
var key = false;
var firstTime = 0;
var lastTime = 0;
var _x, _y; //鼠标离控件左上角的相对位置
jQuery(document).ready(function ($) {
var timer = null;
$("#vanvan").mousedown(function (e) {
_move = true;
firstTime = new Date().getTime();
_x = e.pageX - parseInt($("#vanvan").css("left"));
_y = e.pageY - parseInt($("#vanvan").css("top"));
});
$("#vanvan").click(function (e) {
if(key){
//console.log('click');
key = false;
cancelAnimationFrame(timer);
timer = requestAnimationFrame(function fn(){var oTop = document.body.scrollTop || document.documentElement.scrollTop;if(oTop > 0){document.body.scrollTop = document.documentElement.scrollTop = oTop - 50;timer = requestAnimationFrame(fn);}else{cancelAnimationFrame(timer);} });
//document.body.scrollTop = document.documentElement.scrollTop = 0;scrollTo(0,0);
$(".mumu").fadeTo("300", 1);
}
});
$(document).mousemove(function (e) {
if (_move) {
var x = e.pageX - _x;
var y = e.pageY - _y;
var wx = $(window).width() - $('#vanvan').width();
var dy = $(document).height() - $('#vanvan').height();
if(x >= 0 && x <= wx && y > 0 && y <= dy) {
$("#vanvan").css({
top: y,
left: x
}); //控件新位置
ismove = true;
}
}
}).mouseup(function () {
_move = false;
lastTime = new Date().getTime();
if( (lastTime - firstTime) < 200){
key = true;
}
});
});