2013-04-08 56 views
-2

我試圖做一個jQuery的內部的一些文本效果基本show滑下的要求,但是當我添加另一個jQuery代碼呢?所以這裏顯示了這個jQuery的jQuery的裏面的

​ 

是我的代碼

<head> 
     <script type="text/javascript"> 
<!-- HIDE FROM INCOMPATIBLE BROWSERS 
var fish1Position = 0; 
var fish2Position = 0; 
var fish3Position = 99; 
var horizontal = []; 
var fillPosition = 10; 
var num = 100; 
for(var i = 0; i < 100; ++i) { 
     horizontal[i] = fillPosition; 
     fillPosition += 10; 
} 

function fish1Swim() { 
     document.getElementById("fish1").style.left = horizontal[fish1Position] + "px"; 
     ++fish1Position; 
     if (fish1Position == num) { 
       fish1Position = 0; 
} 
var tim1 = setTimeout(fish1Swim, 100); 
} 
function fish2Swim(){ 
     document.getElementById("fish2").style.left = horizontal[fish2Position] + "px"; 
     ++fish2Position; 
     if (fish2Position == num) { 
       fish2Position = 0; 
} 
var tim2 = setTimeout(fish2Swim, 200); 
} 

function fish3Swim() { 
    document.getElementById("fish3").style.left = horizontal[fish3Position] + "px"; 
    ++fish3Position; 
    if (fish3Position == num) { 
fish3Position = 99; 
} 
var tim3 = setTimeout(fish3Swim, 300); 
} 

function startSwimming() { 
     fish1Swim(); 
     fish2Swim(); 
     fish3Swim(); 
} 

// STOP HIDING FROM INCOMPATIBLE BROWSERS --> 
</script> 
</head> 
//////////////////////////////////////////////////////////// 
///////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////// 
///////////////////////////////////////////////////////////// 
<body> 
<ul> 
<li><img src='http://station2k.com/blank-hockey-puck.png' width='17px' height='17px'> {$nhlteam} ​<span id='fish1'>{$nhlmessage}</span></li> 
<li><img src='http://station2k.com/blank-hockey-puck.png' width='17px' height='17px'> {$nhlteam} ​<span id='fish1'>{$nhlmessage}</span></li> 
</ul> 
///////////////////////////////////////////////////////////////// 
//////////////////////////////////////////////////////////////// 
/////////////////////////////////////////////////////////////// 
////////////////////////////////////////////////////////////// 
<!-- include jQuery core code --> 
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script> 
<script> 
$(document).ready(function() { 
    function textloop() { 
    // get the item that currently has the 'show' class 
    var current = $('#items .show'); 
    /* 
    * find the next item with some help from jQuery's ternary operator 
    * the syntax for the ternary operator is 'a ? b : c' 
    * in other words 'if a is true return b otherwise return c' 
    */ 
    var next = current.next().length ? current.next() : current.parent().children(':first'); 
    // fade out the current item and remove the 'show' class 
    current.delay(5000).slideUp('slow',function(){ 
     // fade in the next item and add the 'show' class 
     next.slideDown('slow').addClass('show'); 
    }).removeClass('show'); 

    // repeat by calling the textloop method again after 3 seconds 
    setTimeout(textloop,0); 
    } 

    // call the text loop method when the page loads 
    textloop(); 
}); 
</script> 

任何有關使列表中的文本滾動的幫助? PREF的標籤,我可以id作爲我不想整個腳本滾動從右到左

+0

你有沒有嘗試鏈接到外部腳本,而不是嵌入 – Jlange 2013-04-08 16:17:29

+0

不,我會試試這個 – 2013-04-08 16:21:15

+0

我是否會將腳本標記包裹在span中? – 2013-04-08 16:23:55

回答

0

試試你的PHP值輸出修改此:

<li><img src='http://station2k.com/blank-hockey-puck.png' width='17px' height='17px'><?php echo $nhlteam ?>​<span id='fish1'><?php echo $nhlmessage ?></span></li> 

你所看到的符號是ASCII表示內存指針指向你的變量。

+0

我做到了,現在它沒有迴應字符串大聲笑,我知道有什麼字符串..... grrr我下來投票要求一個很好的問題。儘管感謝您的幫助! – 2013-04-09 00:59:44