I am new to jquery and Javascript and I am running into a problem which I hope somebody here will be able to solve. I have setup a jquery Cycle plugin to display some content in a div. Now I also have certain links load some different content in another div. Upon load, the cycle works fine, but when I click any of the links and load the content in the other div, this cycle stops working. Please do note that I am using an inline javascript in the hrefs of the links. And that is creating the conflict. My code:
<script type="text/javascript">
$(document).ready(function() {
$(".paras").cycle({
fx: 'fade',
speed: 200,
timeout: 1000,
next: '.tnext',
prev: '.tprev',
cleartype: '1'
})
content(1); /* To load content 1 on page load */
});
function content(i){
if (i == 1) {/* Code to load content in BIG DIV from external HTML */}
if (i == 2) {/* Code to load content in BIG DIV from external HTML */}
if (i == 3) {/* Code to load content in BIG DIV from external HTML */}
}
</script>
<ul>
<li><a class="home" href="javascript:content(1)">Home</a></li>
<li><a class="work" href="javascript:content(2)">Work</a></li>
<li><a class="about" href="javascript:content(3)">About</a></li>
</ul>
<div>
/* This is the big div */
</div>
<div class="paras">
/* This is the small div. Content loaded using jquery cycle. Stops cycling when content loaded in BIG DIV */
</div>
Can anyone suggest how to keep Cycle working while also keeping the inline javascript intact? Or do you suggest something better.