Thanks for your replies on this.
I only just got around to trying out the suggestions to use jquery to update the div contents. Unfortunately, they don't seem to work and produce the same result as my initial code?
There must be a way to do this.
Any advice most appreciated.
Thanks.


On 27 Apr 2007, at 15:57, Fabyo Guimaraes wrote:

Use jquery = )

$(document).ready(function() {
    $("#news").newsTicker();
}
);

function showdiv() {
    $("#news").css("display", "block");
}

function hidediv() {
    $("#news").css("display", "none");
}

function replacecontents() {
$("#news").html("<li>Replaced 1</li><li>Replaced 2</ li><li>Replaced 3</li><li>Replaced 4</li>");
}



2007/4/27, djl <[EMAIL PROTECTED]>:
Hi there,
I've got a simple page that uses the newsticker plug-in (http:// www.texotela.co.uk/code/jquery/newsticker/ ), as follows:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
.newsticker {
        list-style-type: none;
         list-style-position:outside;
        padding:0 0 0 0;
        margin:0 0 0 0;
        font-family:"Lucida Grande", Geneva, Arial, Helvetica, sans-serif;
        font-size:12px;
        color:#000;
}
</style>
<script type="text/javascript" src="javascript/jquery-1.1.1.js"></ script> <script type="text/javascript" src="javascript/jquery- newsticker.js"></script>
<script type="text/javascript">
$(document).ready(
        function()
        {
                $("#news").newsTicker();
        }
);

function showdiv() {
document.getElementById('news').style.display='block';
}

function hidediv() {
document.getElementById('news').style.display='none';
}

function replacecontents() {
info='<li>Replaced 1</li><li>Replaced 2</li><li>Replaced 3</ li><li>Replaced 4</li>';
document.getElementById('news').innerHTML=info;
}
</script>
</head>
<body>
                <ul id="news">
                        <li>Item 1</li>
                        <li>Item 2</li>
                        <li>Item 3</li>
                        <li>Item 4</li>
                 </ul>
                <input type="button" value="Show" onclick="showdiv();" />
                 <input type="button" value="Hide" onclick="hidediv();" />
                <input type="button" value="Replace" onclick="replacecontents();" 
/>
</body>
</html>


The resulting page looks like this:-

The ticker rotates through 'Item 1', 'Item 2', 'Item 3' and 'Item 4'



The problem is clicking the 'Replace' button runs the replacecontents function which updates the div contents with a list, thus breaking the ticker effect as below:-


Having had similar experiences with other plug-ins I'm thinking the plug-in code needs to somehow be re-initiated. My question is, is there a way to dynamically run or re-run $ (document).ready or similar? Or am I missing something/is there a 'proper' way to do what I'm after?

Many thanks in advance.




Reply via email to