使用 JQuery 对 2 个单独的项目进行动画处理并在鼠标悬停时暂停这两个项目
我对这个问题有点恼火。在地图上,我有一系列点,它们分配了两个操作:
onmouseover : pops up a tooltip
click: changes the content in the panel on the right
页面设置为自动播放填充左侧面板的项目。
我想做的是让相应的工具提示与左侧面板一致突出显示。
然后,我希望当用户将鼠标悬停在地图上的任何点上时,两者都完全停止。
我一直非常沮丧,我的 javascript 知识相当薄弱,尽管我已经取得了不错的进步,但我还是不断地找错树。
我只是有一种感觉,我没有以正确的方式处理这件事,如果有人能给我一些指导,我将不胜感激。
这是我正在使用的代码:
$(document).ready(function() {
jcps.fader(100, '#switcher-panel');
setTimeout("callCity('#la')",2000);
setTimeout("callCity('#mexico')",4000);
setTimeout("callCity('#ny')",6000);
setTimeout("callCity('#singapore')",8000);
setTimeout("callCity('#australia')",10000);
setTimeout("callCity('#france')",12000);
setTimeout("callCity('#england')",14000);
setTimeout("callCity('#spain')",16000);
setTimeout("callCity('#canada')",18000);
setTimeout("callCity('#chicago')",20000);
setTimeout("callCity('#minn')",22000);
setTimeout("callCity('#stpaul')",24000);
setTimeout("callCity('#dallas')",26000);
setTimeout("callCity('#boston')",28000);
setTimeout("callCity('#arizona')",30000);
});
function callCity(city)
{
$(city).trigger('click');
}
$('#berlin').mousedown(function() {
alert('Handler for .mousedown() called.');
});
</script>
I've been going a little batty with this problem. On the map I have a series of dots that have two actions assigned to them:
onmouseover : pops up a tooltip
click: changes the content in the panel on the right
The page is set to auto play through the items that populate the left panel.
What I'd like to do is have the corresponding tooltips highlight in unison with the left panel.
And then, I'd like both to completely stop when the user mouses over any dot on the map.
I've been very frustrated, my javascript knowledge is rather weak and I keep barking up the wrong tree even though I've made decent progress.
I just have a feeling that I'm not going about this the right way, if anyone could offer me a little guidance I'd be appreciative.
Here is the code that I'm using:
$(document).ready(function() {
jcps.fader(100, '#switcher-panel');
setTimeout("callCity('#la')",2000);
setTimeout("callCity('#mexico')",4000);
setTimeout("callCity('#ny')",6000);
setTimeout("callCity('#singapore')",8000);
setTimeout("callCity('#australia')",10000);
setTimeout("callCity('#france')",12000);
setTimeout("callCity('#england')",14000);
setTimeout("callCity('#spain')",16000);
setTimeout("callCity('#canada')",18000);
setTimeout("callCity('#chicago')",20000);
setTimeout("callCity('#minn')",22000);
setTimeout("callCity('#stpaul')",24000);
setTimeout("callCity('#dallas')",26000);
setTimeout("callCity('#boston')",28000);
setTimeout("callCity('#arizona')",30000);
});
function callCity(city)
{
$(city).trigger('click');
}
$('#berlin').mousedown(function() {
alert('Handler for .mousedown() called.');
});
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不太明白这个问题,但这可能会有所帮助
http://jsfiddle.net/KXLBV/
I don't really understand the question but this might help
http://jsfiddle.net/KXLBV/
我的一个朋友帮我解决了这个问题......这是代码:
A buddy of mine helped me sort this out...here's the code: