jeudi 1 janvier 2015

Can not get jquery functions working


Vote count:

0




I am trying to make a div that moves in and out of the page, however I can not make the jqeury function work.


It works perfectly here:


http://ift.tt/1K5zYT8



$('#toggle').toggle(
function() {
$('#popout').animate({ left: 0 }, 'slow', function() {
$('#toggle').html('Close');
});
},
function() {
$('#popout').animate({ left: -40 }, 'slow', function() {
$('#toggle').html('Show');
});
}
);

<div id="popout">
<div id="toggle">Show</div>
<br style="clear: both" />
<ul>
<li>a</li>
<li>b</li>
<li>c</li>
<li>d</li>
</ul>
</div>

#popout { position: fixed; height: 100px; width: 75px; border: 1px dotted gray; background: darkblue; color: white; top:50px; left: -40px; }
#toggle { float: right; }


Here is how I tried implementing the function:



<head>
<meta charset="UTF-8">
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script src="http://ift.tt/1mWWrGH"></script>
<script>
$('#toggle').toggle(
function() {
$('#popout').animate({ left: 0 }, 'slow', function() {
$('#toggle').html('Close');
});
},
function() {
$('#popout').animate({ left: -40 }, 'slow', function() {
$('#toggle').html('Show');
});
}
);

</script>
</head>


However on my page it does not work. Why is this



asked 58 secs ago







Can not get jquery functions working

Aucun commentaire:

Enregistrer un commentaire