Updatepanel中的猫头鹰轮播消失

Updatepanel中的猫头鹰轮播消失

本文介绍了回发后,Updatepanel中的猫头鹰轮播消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以控制中继器以显示某些内容.

I have repeater control to show something.

<div class="owl-carousel trend" style="height:20px;">
    <asp:Repeater ID="rptThing" runat="server" DataSourceID="yyy">
        <ItemTemplate>
            <asp:LinkButton ID="lnkEtiket" runat="server" OnClick="lnkEtiket_Click">go</asp:LinkButton>
        </ItemTemplate>
    </asp:Repeater>
</div>

它在updatepanel的内部.页面加载没有问题,但是当onClik消失时.我了解有关Ajax&的信息jQuery的问题,但我不能解决问题.我尝试了很多例子.这是我的jQuery

It's inside of an updatepanel. No problem on page load but when onClik it disappears. I know it about ajax & jquery issue but I couldn't solve problem. I tried so many examples. Here is my jquery

<script type=text/javascript>
    var owltrend = $('.trend');
    owltrend.owlCarousel({
        margin: 5,
        loop: true,
        startPosition: 0,
        lazyLoad: true,
        rtl: false,
        nav: false,
        autoWidth: true,
    });
</script>

注意:它的猫头鹰传送带2

Note: Its owl carousel 2

推荐答案

您需要再次触发jQuery绑定.

You need to trigger the jQuery binding again.

<script type="text/javascript">
    $(document).ready(function () {
        createCarousel();
    });

    var prm = Sys.WebForms.PageRequestManager.getInstance();

    prm.add_endRequest(function () {
        createCarousel();
    });

    function createCarousel() {
        var owltrend = $('.trend');
        owltrend.owlCarousel({
            margin: 5,
            loop: true,
            startPosition: 0,
            lazyLoad: true,
            rtl: false,
            nav: false,
            autoWidth: true,

        });
    }
</script>

当UpdatePanel加载完成时,会触发

prm.add_endRequest.

prm.add_endRequest is triggered when the UpdatePanel is done loading.

这篇关于回发后,Updatepanel中的猫头鹰轮播消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 08:47