fadein和fadeout的效果似乎不起作用。我在ModalPopUpExtender上看过很多关于fadeIn和fadeOut的文章,并解决了之前发生的所有错误,但我仍然不知道为什么当我运行它时,我无法看到fadein和fadeout的影响。此外,没有显示错误。
这是我的.aspx代码,供您参考。
的Javascript
<script type="text/javascript">
function pageLoad() {
$addHandler($get("showModalPopupClientButton"), 'click', showModalPopupViaClient);
$addHandler($get("hideModalPopupViaClientButton"), 'click', hideModalPopupViaClient);
}
function showModalPopupViaClient(ev) {
ev.preventDefault();
var modalPopupBehavior = $find('buttonPopUp_ModalPopupExtender');
$find("AnimationExtender1").get_OnClickBehavior().play();
modalPopupBehavior.show();
}
function hideModalPopupViaClient(ev) {
ev.preventDefault();
var modalPopupBehavior = $find('buttonPopUp_ModalPopupExtender');
modalPopupBehavior.hide();
}
</script>
HTML
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Button ID="buttonPopUp" runat="server" CssClass="hide"/>
<asp:ModalPopupExtender ID="buttonPopUp_ModalPopupExtender" runat="server"
DynamicServicePath="" Enabled="True" TargetControlID="buttonPopUp" BehaviorID="buttonPopUp_ModalPopupExtender"
PopupControlID="PopUp" BackgroundCssClass="modalBackground" DropShadow="true" >
</asp:ModalPopupExtender>
<asp:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="FadeIn">
<Animations>
<OnClick>
<Sequence AnimationTarget="PopUp">
<FadeIn Duration="1" MinimumOpacity="0" MaximumOpacity="1" />
</Sequence>
</OnClick>
</Animations>
</asp:AnimationExtender>
<asp:AnimationExtender ID="AnimationExtender2" runat="server" TargetControlID="FadeIn">
<Animations>
<OnClick>
<Sequence AnimationTarget="PopUp">
<FadeOut Duration="1" MinimumOpacity="0" MaximumOpacity="1" />
</Sequence>
</OnClick>
</Animations>
</asp:AnimationExtender>
<asp:HiddenField runat="server" ID="FadeIn" />
</p>
<div id="PopUp">
<div id="ImagePopUp">
<asp:Image ID="Image4" runat="server" Height="260px" Width="352px" />
</div>
<asp:Label ID="packageName" CssClass="PopUpDeco" runat="server" Text=""></asp:Label>
</div>