DIV
확장/축소하려고합니다. 내가 원하는 높이로 전달하는 함수를 사용하고 있지만 확장 또는 축소하지 않는 것은 DIV
입니다. 누구든지 내가 잘못한 것에 대해 어떤 생각을 가지고 있습니까? JSFiddlejQuery Expand/Collaspe DIV가 제대로 작동하지 않습니다.
<html>
<head>
<style>
.podTitles{
float:left;
clear:none;
font-size:12px;
font-weight:bold;
color:#3A3938;
line-height:23px;
margin-left:10px;
}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type='text/javascript'>
function changeheight(heightval) {
var heightset = heightval + 'px';
if(this.text == 'more')
{
$('#overviewtext').animate({ 'height': heightset }, 600);
$(this).text($(this).text() == 'more' ? 'less' : 'more');
}
else if(this.text == 'less')
{
$('#overviewtext').animate({ 'height': '150px' }, 600);
$(this).text($(this).text() == 'more' ? 'less' : 'more');
}
};
</script>
</head>
<body>
<div style="background-image:url('Images/RedPodHeader.jpg'); background-repeat:no-repeat; width: 360px; height:23px; background-color: red;">
<span class="podTitles">Overview</span>
<span style="float: right; padding-right: 10px;"><a href="javascript:;" onclick="changeheight(250);"id="morelink">more</a></span>
</div>
<div style="height: 150px; width: 338px; padding: 10px; border-bottom: 1px solid silver; border-left: 1px solid silver; border-right: 1px solid silver;" id="overviewtext"> </div>
</body>
</html>
귀하의 코드에서 .... 당신은 jQuery를로드하지 않습니다! – poscaman
@poscaman이 그 행을 복사하는 것을 잊어 버렸습니다. 하지만 jsfiddle 그것은로드 jquery 않습니다 및 여전히 작동하지 않습니다. – ios85