Javascript 使用jquery定位和显示隐藏元素
试图实现类似于qtip的东西,但是使用了一个表来比较不同事物的特性,我遇到了一个问题,我想在鼠标悬停上显示隐藏的元素。任何帮助都将不胜感激Javascript 使用jquery定位和显示隐藏元素,javascript,jquery,css,Javascript,Jquery,Css,试图实现类似于qtip的东西,但是使用了一个表来比较不同事物的特性,我遇到了一个问题,我想在鼠标悬停上显示隐藏的元素。任何帮助都将不胜感激 display.eq(index.css)(“top”、+event.PageY) 需要: display.eq(index.css)(“top”、+event.pageY)-注意小写字母“p”。看起来case有一个简单的问题。event.PageY应为event.PageY 我已经修复了这个问题,并在这里对您的代码进行了一些小的CSS更改:而不是event
display.eq(index.css)(“top”、+event.PageY)代码>
需要:
display.eq(index.css)(“top”、+event.pageY)代码>-注意小写字母“p”。看起来case有一个简单的问题。event.PageY应为event.PageY
我已经修复了这个问题,并在这里对您的代码进行了一些小的CSS更改:而不是event.pageY
,我尝试使用$(this.position()。top
和50到position的偏移量就在链接的正下方。见下文
content.on('mouseenter',function(){ //Used .on instead of bind
var index=content.index(this);
if(index<0){
stop();
}
else{
content.eq(index).css("font-weight","bold");
display.stop(true,true);
display.eq(index).css("top",+ $(this).position().top + 50); //Changed
display.eq(index).fadeIn('slow');
}
}).on('mouseleave',function(){ //Used .on instead of bind
var index=content.index(this);
display.hide();
content.css("font-weight","normal");
});
content.on('mouseenter',function(){//Used.on代替bind
var指数=内容指数(本);
if(indexh)您希望如何定位隐藏的元素?同意这一点。$(this).position().top
将使工具提示的位置更加一致。非常感谢,这是一个令人沮丧的疏忽。