Prev | Current Page 637 | Next

Frank Zammetti

"Practical DWR 2 Projects"

element.style.display = "block";
},
afterUpdate : function(inObj) {
if (parseInt(inObj.element.style.height.replace("px", "")) < 40) {
inObj.element.style.height = "40px";
}
}
});
}
First, the BlindUp effect is used to ???roll up??? the section. However, two problems arise. First,
we want the header portion of the section to still be visible. So, following each iteration of the
effect loop, which is where the afterUpdate parameter comes into play, we check the height of
the section. We do this by taking the reference to the object passed in, which is the section
being collapsed, and we get its style.height attribute. Because this value is in the form99px,
where 99 is the current height, we need to strip off the px portion, and then we compare the
resultant integer (which we get with the parseInt() function), and if it??™s less than 40 pixels, we
set the height of the section to 40 pixels. That effectively keeps the header portion always visible.
One final step is required, and that??™s when the effect is all done, afterFinish, we make
sure the final height of the section is 40 pixels and that it is fully displayed (because the effect
itself will hide the section once it??™s completely rolled up).


Pages:
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649