2011-10-22 20 views
-2

http://nerotic.net/auxout/動畫2個獨立的項目使用jQuery和鼠標懸停

我已經打算這個問題有點古怪暫停兩者。在地圖上,我有一系列點分配給他們的兩個動作:

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> 
+0

您需要接受更多答案 –

+0

您應該張貼一些代碼以獲取更多幫助。 – xmarcos

+0

感謝Moin ...我回到了我的一些舊帖子,並接受了那些幫助我的最佳答案。 – nero

回答

0

幫我的一個朋友我對此進行了整理...這是代碼:

<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> 
0

我真的不明白的問題,但是這可能幫助

$('.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/

+0

感謝您的想法,但它與我想要完成的完全不同。我發佈了現在適用於我的解決方案。 – nero