使用 JQuery 对 2 个单独的项目进行动画处理并在鼠标悬停时暂停这两个项目

发布于 2024-12-11 20:06:31 字数 1856 浏览 0 评论 0原文

http://nerotic.net/auxout/

我对这个问题有点恼火。在地图上,我有一系列点,它们分配了两个操作:

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> 

http://nerotic.net/auxout/

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

翻身的咸鱼 2024-12-18 20:06:31

我不太明白这个问题,但这可能会有所帮助

$('.animate').each(function() {

    $(this).animate({height: '600px'}, 10000);
});

$('.animate').click(function() {

    $(this).animate({width: '600px'}, 10000);
});

$('.stop').mouseover(function() {

    $('.animate').stop();
});

http://jsfiddle.net/KXLBV/

I don't really understand the question but this might help

$('.animate').each(function() {

    $(this).animate({height: '600px'}, 10000);
});

$('.animate').click(function() {

    $(this).animate({width: '600px'}, 10000);
});

$('.stop').mouseover(function() {

    $('.animate').stop();
});

http://jsfiddle.net/KXLBV/

娜些时光,永不杰束 2024-12-18 20:06:31

我的一个朋友帮我解决了这个问题......这是代码:

<script type="text/javascript">
                   $(document).ready(function() {
                   jcps.fader(100, '#switcher-panel');
                   var timeouts = new Array();
                   var cities = ["#la", "#mexico", "#ny", "#singapore", "#australia", "#italy", "#france", "#england", "#spain", "#canada", "#chicago", "#minn", "#stpaul", "#dallas", "#boston", "#berlin", "#arizona"];
                   var timeoutLength = 3400;
                   for (i = 0; i < cities.length; i++)
                   {
                       timeouts[i] = setTimeout("callCity('" + cities[i] +"')", timeoutLength * (i + 1));
                   }
                       $('.switcher').mouseover(function() {
                          for( key in timeouts )
                          {  
                            clearTimeout(timeouts[key]);  
                             }
                           });
                   });
                   function callCity(city)
                    {
                    $(city).trigger('click');
                    }
                </script>   

A buddy of mine helped me sort this out...here's the code:

<script type="text/javascript">
                   $(document).ready(function() {
                   jcps.fader(100, '#switcher-panel');
                   var timeouts = new Array();
                   var cities = ["#la", "#mexico", "#ny", "#singapore", "#australia", "#italy", "#france", "#england", "#spain", "#canada", "#chicago", "#minn", "#stpaul", "#dallas", "#boston", "#berlin", "#arizona"];
                   var timeoutLength = 3400;
                   for (i = 0; i < cities.length; i++)
                   {
                       timeouts[i] = setTimeout("callCity('" + cities[i] +"')", timeoutLength * (i + 1));
                   }
                       $('.switcher').mouseover(function() {
                          for( key in timeouts )
                          {  
                            clearTimeout(timeouts[key]);  
                             }
                           });
                   });
                   function callCity(city)
                    {
                    $(city).trigger('click');
                    }
                </script>   
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文