Javascript ListView中可折叠面板的平滑动画
我有以下代码来平滑可折叠面板上的动画,它工作得非常出色:Javascript ListView中可折叠面板的平滑动画,javascript,asp.net,ajax,animation,Javascript,Asp.net,Ajax,Animation,我有以下代码来平滑可折叠面板上的动画,它工作得非常出色: <script type="text/javascript"> function pageLoad(sender, args) { smoothAnimation(); } function smoothAnimation() { var collPanel = $find(("<%= CollapsiblePanelExtender.ClientID %&g
<script type="text/javascript">
function pageLoad(sender, args) {
smoothAnimation();
}
function smoothAnimation() {
var collPanel = $find(("<%= CollapsiblePanelExtender.ClientID %>"));
collPanel._animation._fps = 30;
collPanel._animation._duration = 0.5;
}
</script>
函数页面加载(发送方,参数){
平滑动画();
}
函数smoothAnimation(){
var collPanel=$find((“”);
collPanel._动画_fps=30;
collPanel._动画。_持续时间=0.5;
}
现在,我还有一个独立于上面面板的listview,它在每个项目中都有一个可折叠的面板扩展程序。我想将“smoothAnimation()”函数应用于每个项目,但我不知道如何实现,因为数据绑定为每个项目提供了一个唯一的ID
有人知道如何用javascript实现这一点吗?非常感谢您的帮助。请使用OnItemCreated事件,并使用以下命令:
protected void ListItems_Created(object sender, ListViewItemEventArgs e)
{
CollapsiblePanelExtender cpe = (CollapsiblePanelExtender)e.Item.FindControl("collapsePanelID");
cpe.Attributes.Add("onload", cpe.ClientID + "._animation._fps = 30;");
cpe.Attributes.Add("onload", cpe.ClientID + "._animation._duration = 0.5;");
}
此代码未经测试,但您只需执行此操作即可。CollapsablePanelExtender没有属性