简体   繁体   中英

Problem while animating boxes using jQuery

On my webpage, I have a few boxes one below the other, on the right side. Each box has a '+' and '-' button which maximizes/minimizes to the specified size, similar to that in portlets. But, for some reason, it is not working as it is suppose to. Here is the code for '-' button:

<script type="text/javascript">
$(function() {
    <?php for($i=0;$i<count($modules);$i++) : ?>        
    $( "#minusbtn<?=$modules[$i]["title"]?>").click(
    function() {
        $( "#effect<?=$modules[$i]  ["title"]?>").animate({                 
height: 35,
}, "slow" );
    <?php $count=0; $top=0; ?>  
    <?php for($j=$i;$j<count($modules);$j++): ?>
    <?php if($i==$j) continue; ?>
        $( "#effect<?=$modules[$j]["title"]?>" ).animate({
        top: <?=($top)?>,
        }, "slow" );
    <?php $count++; $top = (210*$count); ?> 
    <?php endfor; ?>
    });

Please help!

All it is that makes the boxes is this:

$( ".portlet-header" ).click(function() {
    $( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
});

As seen here: http://jsfiddle.net/ndHK4/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM