0

I use of javascript (swiper) inside a update panel.

I have problem that when refresh update panel once swiper doesn't work anymore

<div class="swiper-container">
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <div id="swiperwrapper" runat="server" class="swiper-wrapper">
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div class="swiper-pagination">
    </div>
    <div class="swiper-button-next">
    </div>
    <div class="swiper-button-prev">
    </div>
</div>
<script src="js/swiper/swiper.min.js"></script>
<script>
    var swiper = new Swiper('.swiper-container', {
        slidesPerView: 4,
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        pagination: '.swiper-pagination',
        paginationType: 'none'
    });
</script>
Chiako
  • 704
  • 1
  • 8
  • 17
  • Can you explain what you mean? That's not very clear. How are you refreshing the panel? If it's being completely rerendered then it may simply be that you need to run the swiper initialisation again. – Reinstate Monica Cellio Jul 11 '16 at 08:27
  • You need to re-initialize the javascript after the update panel refres the content - there are many more similar answers on so – Aristos Jul 11 '16 at 08:36
  • and one more http://stackoverflow.com/questions/13955201/validation-plugin-is-not-working-in-update-panel/13955293#13955293 – Aristos Jul 11 '16 at 08:38
  • @Aristos I did but dosent work – Chiako Jul 11 '16 at 08:43
  • Yes it's works - if you do it correctly. Open your browser console, see your javascript errors - did you page have errors too ? You have it place it on the end, to run after the page loads - also use a sync to run when the page loads, not because is on the bottom. – Aristos Jul 11 '16 at 08:44

0 Answers0