Javascript 悬停区的射击功能
我试图在你翻滚到红色区域时启动一个函数 有什么建议吗Javascript 悬停区的射击功能,javascript,jquery,hover,Javascript,Jquery,Hover,我试图在你翻滚到红色区域时启动一个函数 有什么建议吗 $(document).ready(function() { $("#wrapper").bind('mousemove', function(e) { $("#tail").css({ top: e.pageY }); }); }); 添加:要返回到起始位置: $(document).ready(function() { $("#wrapper").hove
$(document).ready(function() {
$("#wrapper").bind('mousemove', function(e) {
$("#tail").css({
top: e.pageY
});
});
});
添加:要返回到起始位置:
$(document).ready(function() {
$("#wrapper").hover(function() {
$.data(this, "tail_Y", $("#tail").css("top"));
}, function() {
$("#tail").css("top", $.data(this, "tail_Y"));
}).bind('mousemove', function(e) {
$("#tail").css({
top: e.pageY
});
});
});
添加:要返回到起始位置:
$(document).ready(function() {
$("#wrapper").hover(function() {
$.data(this, "tail_Y", $("#tail").css("top"));
}, function() {
$("#tail").css("top", $.data(this, "tail_Y"));
}).bind('mousemove', function(e) {
$("#tail").css({
top: e.pageY
});
});
});
这有什么帮助吗
$(document).bind('mousemove', function(e){
$('#tail').css({
top: e.pageY
});
$('#wrapper').click(function(){
xyz();
});
});
function xyz()
{
alert('hello');
}
希望这有帮助
$(document).bind('mousemove', function(e){
$('#tail').css({
top: e.pageY
});
$('#wrapper').click(function(){
xyz();
});
});
function xyz()
{
alert('hello');
}
试试这个:
$("#wrapper").mouseover(function() {
// your function here
alert("mouse over red area");
});
试试这个:
$("#wrapper").mouseover(function() {
// your function here
alert("mouse over red area");
});
一旦dom就绪,您必须确保运行以下代码:
$("#wrapper").bind('mouseenter', function(e) {
alert("Entered Wrapper")
});
您必须确保在dom就绪后运行以下代码:
$("#wrapper").bind('mouseenter', function(e) {
alert("Entered Wrapper")
});
太棒了,有没有办法让尾巴回复到原来的位置?你会在鼠标移出时删除CSS功能吗?@dzejkej是的!非常感谢你,有没有办法让尾巴回复到原来的位置?你会在鼠标移出时删除CSS功能吗?@dzejkej是的!非常感谢你