change owl carousel 2 options after setup?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







3















I'm searching for change owl carousel 2 options after setup more specifically.



I am searching a way to disable drag of parent element of the drag element like this:



$('#carousel').on('drag.owl.carousel', function(event) {

$('.carousel').on('drag.owl.carousel', function(event) {
//disable drag
})
})

$('#carousel').on('dragged.owl.carousel', function(event) {

$('.carousel').on('dragged.owl.carousel', function(event) {
//enable drag
})
})









share|improve this question































    3















    I'm searching for change owl carousel 2 options after setup more specifically.



    I am searching a way to disable drag of parent element of the drag element like this:



    $('#carousel').on('drag.owl.carousel', function(event) {

    $('.carousel').on('drag.owl.carousel', function(event) {
    //disable drag
    })
    })

    $('#carousel').on('dragged.owl.carousel', function(event) {

    $('.carousel').on('dragged.owl.carousel', function(event) {
    //enable drag
    })
    })









    share|improve this question



























      3












      3








      3








      I'm searching for change owl carousel 2 options after setup more specifically.



      I am searching a way to disable drag of parent element of the drag element like this:



      $('#carousel').on('drag.owl.carousel', function(event) {

      $('.carousel').on('drag.owl.carousel', function(event) {
      //disable drag
      })
      })

      $('#carousel').on('dragged.owl.carousel', function(event) {

      $('.carousel').on('dragged.owl.carousel', function(event) {
      //enable drag
      })
      })









      share|improve this question
















      I'm searching for change owl carousel 2 options after setup more specifically.



      I am searching a way to disable drag of parent element of the drag element like this:



      $('#carousel').on('drag.owl.carousel', function(event) {

      $('.carousel').on('drag.owl.carousel', function(event) {
      //disable drag
      })
      })

      $('#carousel').on('dragged.owl.carousel', function(event) {

      $('.carousel').on('dragged.owl.carousel', function(event) {
      //enable drag
      })
      })






      javascript jquery html5 css3 owl-carousel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 16 '14 at 10:20









      rene

      33.9k1181111




      33.9k1181111










      asked Aug 16 '14 at 10:12









      gauvain robertgauvain robert

      63225




      63225
























          6 Answers
          6






          active

          oldest

          votes


















          1














          Rather than try to disable the drag via hooking into the drag events, it would be better to use the owl.reinit() function, along with the touchDrag and mouseDrag options. For instance, if you had a carousel #carousel:



          var $carousel = $('#carousel');
          var owl = $carousel.data('owlCarousel'); # Your DOM element gets an 'owlCarousel' data property containing the Owl object.
          owl.reinit({touchDrag: false, mouseDrag: false;});


          Although the method is named reinit, it won't blank any of your previously-set options.






          share|improve this answer





















          • 1





            ok but how do you reinit in the seond version of the carousel

            – gauvain robert
            Aug 16 '14 at 11:31











          • If you have two carousels, then they'll be in separate DOM elements. Each one will have its own owl object that you can access via .data('owlCarousel'). You can call reinit() on both, and it will only affect that particular carousel. You can also call reinit() multiple times on the same one, if you want to toggle dragging on and off.

            – Alex P
            Aug 16 '14 at 11:34








          • 5





            @AlexP I think he was referring to version 2 of the plugin rather than 2 carousels. There doesn't seem to be a reinit method in v2

            – Andy
            Jan 22 '15 at 10:04











          • @Andy is absolutely right. this is not an answer to the question, as It clearly addresses the first version, not the second. All software improve as the version number increases, this one seems to go in opposite direction!

            – Trix
            Feb 15 '16 at 23:28






          • 1





            The link to owlCarousel documentation in the post leads to spam page and should be changed/removed (as at 11 Oct 2017)

            – RickL
            Oct 11 '17 at 13:23





















          3














          None of solutions above work for me on owl carousel 2.2.
          I wanted to change stagePadding on init and resize event.



          My solution :



              var owl = $('.page-item-gal');   
          owl.owlCarousel({
          ...
          onResized : setStagePaddingOC,
          });
          function setStagePaddingOC()
          {
          var carousel = owl.data('owl.carousel');
          var StgPad = ($( window ).width() - owl.parent().parent().find('.width-helper').width()) / 2;
          carousel.settings.stagePadding = StgPad;
          carousel.options.stagePadding = StgPad;
          owl.trigger('refresh.owl.carousel');
          }
          setStagePaddingOC(); // onInitialized doesn't work





          share|improve this answer
























          • Verified this solution works in version 2.2.1.

            – Jason
            Apr 18 '17 at 17:13



















          2














          It looks like the API of Owl 2.0 is a moving target, so the call may depend on what version you're on. For me it's:



          $('.carousel').trigger('changeOption.owl.carousel', {
          mouseDrag: false,
          touchDrag: false,
          pullDrag: false
          });


          But for you it may be something like:



          $('.carousel').trigger('change', { property: { name: 'mouseDrag', value: false } });


          Or



          $('.carousel').trigger('change.owl.carousel', {
          mouseDrag: false,
          touchDrag: false,
          pullDrag: false
          });


          So all together it may look like:



          $('#carousel').on('drag.owl.carousel', function() {
          $('.carousel').trigger('change.owl.carousel', {
          mouseDrag: false,
          touchDrag: false,
          pullDrag: false
          });
          }).on('dragged.owl.carousel', function() {
          $('.carousel').trigger('change.owl.carousel', {
          mouseDrag: true,
          touchDrag: true,
          pullDrag: true
          });
          });





          share|improve this answer































            1














            owl.trigger('refresh.owl.carousel');


            best option to reinit & update






            share|improve this answer































              0














              yes owl carousel version 2 ..



              this works for me ( acces options directly )



                  var $carousel = $('#carousel');
              var owl = $carousel.data('owlCarousel');

              w = $( window ).width();
              var animateStyle = 'fadeOut';
              if(w <= 768){
              animateStyle = false;
              }
              owl.options.animateOut = animateStyle;





              share|improve this answer



















              • 3





                It doesn't work for me

                – Parhum
                Dec 15 '15 at 8:55



















              0














              The answers above didnt work for me but this did:



              var $carousel = jQuery('#owl-carousel-block');
              var carouselData = $carousel.data();
              var carouselOptions = carouselData['owl.carousel'].options;
              carouselOptions.loop = true;
              $carousel.trigger('refresh.owl.carousel');





              share|improve this answer
























                Your Answer






                StackExchange.ifUsing("editor", function () {
                StackExchange.using("externalEditor", function () {
                StackExchange.using("snippets", function () {
                StackExchange.snippets.init();
                });
                });
                }, "code-snippets");

                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "1"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25339140%2fchange-owl-carousel-2-options-after-setup%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                6 Answers
                6






                active

                oldest

                votes








                6 Answers
                6






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                1














                Rather than try to disable the drag via hooking into the drag events, it would be better to use the owl.reinit() function, along with the touchDrag and mouseDrag options. For instance, if you had a carousel #carousel:



                var $carousel = $('#carousel');
                var owl = $carousel.data('owlCarousel'); # Your DOM element gets an 'owlCarousel' data property containing the Owl object.
                owl.reinit({touchDrag: false, mouseDrag: false;});


                Although the method is named reinit, it won't blank any of your previously-set options.






                share|improve this answer





















                • 1





                  ok but how do you reinit in the seond version of the carousel

                  – gauvain robert
                  Aug 16 '14 at 11:31











                • If you have two carousels, then they'll be in separate DOM elements. Each one will have its own owl object that you can access via .data('owlCarousel'). You can call reinit() on both, and it will only affect that particular carousel. You can also call reinit() multiple times on the same one, if you want to toggle dragging on and off.

                  – Alex P
                  Aug 16 '14 at 11:34








                • 5





                  @AlexP I think he was referring to version 2 of the plugin rather than 2 carousels. There doesn't seem to be a reinit method in v2

                  – Andy
                  Jan 22 '15 at 10:04











                • @Andy is absolutely right. this is not an answer to the question, as It clearly addresses the first version, not the second. All software improve as the version number increases, this one seems to go in opposite direction!

                  – Trix
                  Feb 15 '16 at 23:28






                • 1





                  The link to owlCarousel documentation in the post leads to spam page and should be changed/removed (as at 11 Oct 2017)

                  – RickL
                  Oct 11 '17 at 13:23


















                1














                Rather than try to disable the drag via hooking into the drag events, it would be better to use the owl.reinit() function, along with the touchDrag and mouseDrag options. For instance, if you had a carousel #carousel:



                var $carousel = $('#carousel');
                var owl = $carousel.data('owlCarousel'); # Your DOM element gets an 'owlCarousel' data property containing the Owl object.
                owl.reinit({touchDrag: false, mouseDrag: false;});


                Although the method is named reinit, it won't blank any of your previously-set options.






                share|improve this answer





















                • 1





                  ok but how do you reinit in the seond version of the carousel

                  – gauvain robert
                  Aug 16 '14 at 11:31











                • If you have two carousels, then they'll be in separate DOM elements. Each one will have its own owl object that you can access via .data('owlCarousel'). You can call reinit() on both, and it will only affect that particular carousel. You can also call reinit() multiple times on the same one, if you want to toggle dragging on and off.

                  – Alex P
                  Aug 16 '14 at 11:34








                • 5





                  @AlexP I think he was referring to version 2 of the plugin rather than 2 carousels. There doesn't seem to be a reinit method in v2

                  – Andy
                  Jan 22 '15 at 10:04











                • @Andy is absolutely right. this is not an answer to the question, as It clearly addresses the first version, not the second. All software improve as the version number increases, this one seems to go in opposite direction!

                  – Trix
                  Feb 15 '16 at 23:28






                • 1





                  The link to owlCarousel documentation in the post leads to spam page and should be changed/removed (as at 11 Oct 2017)

                  – RickL
                  Oct 11 '17 at 13:23
















                1












                1








                1







                Rather than try to disable the drag via hooking into the drag events, it would be better to use the owl.reinit() function, along with the touchDrag and mouseDrag options. For instance, if you had a carousel #carousel:



                var $carousel = $('#carousel');
                var owl = $carousel.data('owlCarousel'); # Your DOM element gets an 'owlCarousel' data property containing the Owl object.
                owl.reinit({touchDrag: false, mouseDrag: false;});


                Although the method is named reinit, it won't blank any of your previously-set options.






                share|improve this answer















                Rather than try to disable the drag via hooking into the drag events, it would be better to use the owl.reinit() function, along with the touchDrag and mouseDrag options. For instance, if you had a carousel #carousel:



                var $carousel = $('#carousel');
                var owl = $carousel.data('owlCarousel'); # Your DOM element gets an 'owlCarousel' data property containing the Owl object.
                owl.reinit({touchDrag: false, mouseDrag: false;});


                Although the method is named reinit, it won't blank any of your previously-set options.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 8 '18 at 11:07









                Community

                11




                11










                answered Aug 16 '14 at 11:03









                Alex PAlex P

                5,12321427




                5,12321427








                • 1





                  ok but how do you reinit in the seond version of the carousel

                  – gauvain robert
                  Aug 16 '14 at 11:31











                • If you have two carousels, then they'll be in separate DOM elements. Each one will have its own owl object that you can access via .data('owlCarousel'). You can call reinit() on both, and it will only affect that particular carousel. You can also call reinit() multiple times on the same one, if you want to toggle dragging on and off.

                  – Alex P
                  Aug 16 '14 at 11:34








                • 5





                  @AlexP I think he was referring to version 2 of the plugin rather than 2 carousels. There doesn't seem to be a reinit method in v2

                  – Andy
                  Jan 22 '15 at 10:04











                • @Andy is absolutely right. this is not an answer to the question, as It clearly addresses the first version, not the second. All software improve as the version number increases, this one seems to go in opposite direction!

                  – Trix
                  Feb 15 '16 at 23:28






                • 1





                  The link to owlCarousel documentation in the post leads to spam page and should be changed/removed (as at 11 Oct 2017)

                  – RickL
                  Oct 11 '17 at 13:23
















                • 1





                  ok but how do you reinit in the seond version of the carousel

                  – gauvain robert
                  Aug 16 '14 at 11:31











                • If you have two carousels, then they'll be in separate DOM elements. Each one will have its own owl object that you can access via .data('owlCarousel'). You can call reinit() on both, and it will only affect that particular carousel. You can also call reinit() multiple times on the same one, if you want to toggle dragging on and off.

                  – Alex P
                  Aug 16 '14 at 11:34








                • 5





                  @AlexP I think he was referring to version 2 of the plugin rather than 2 carousels. There doesn't seem to be a reinit method in v2

                  – Andy
                  Jan 22 '15 at 10:04











                • @Andy is absolutely right. this is not an answer to the question, as It clearly addresses the first version, not the second. All software improve as the version number increases, this one seems to go in opposite direction!

                  – Trix
                  Feb 15 '16 at 23:28






                • 1





                  The link to owlCarousel documentation in the post leads to spam page and should be changed/removed (as at 11 Oct 2017)

                  – RickL
                  Oct 11 '17 at 13:23










                1




                1





                ok but how do you reinit in the seond version of the carousel

                – gauvain robert
                Aug 16 '14 at 11:31





                ok but how do you reinit in the seond version of the carousel

                – gauvain robert
                Aug 16 '14 at 11:31













                If you have two carousels, then they'll be in separate DOM elements. Each one will have its own owl object that you can access via .data('owlCarousel'). You can call reinit() on both, and it will only affect that particular carousel. You can also call reinit() multiple times on the same one, if you want to toggle dragging on and off.

                – Alex P
                Aug 16 '14 at 11:34







                If you have two carousels, then they'll be in separate DOM elements. Each one will have its own owl object that you can access via .data('owlCarousel'). You can call reinit() on both, and it will only affect that particular carousel. You can also call reinit() multiple times on the same one, if you want to toggle dragging on and off.

                – Alex P
                Aug 16 '14 at 11:34






                5




                5





                @AlexP I think he was referring to version 2 of the plugin rather than 2 carousels. There doesn't seem to be a reinit method in v2

                – Andy
                Jan 22 '15 at 10:04





                @AlexP I think he was referring to version 2 of the plugin rather than 2 carousels. There doesn't seem to be a reinit method in v2

                – Andy
                Jan 22 '15 at 10:04













                @Andy is absolutely right. this is not an answer to the question, as It clearly addresses the first version, not the second. All software improve as the version number increases, this one seems to go in opposite direction!

                – Trix
                Feb 15 '16 at 23:28





                @Andy is absolutely right. this is not an answer to the question, as It clearly addresses the first version, not the second. All software improve as the version number increases, this one seems to go in opposite direction!

                – Trix
                Feb 15 '16 at 23:28




                1




                1





                The link to owlCarousel documentation in the post leads to spam page and should be changed/removed (as at 11 Oct 2017)

                – RickL
                Oct 11 '17 at 13:23







                The link to owlCarousel documentation in the post leads to spam page and should be changed/removed (as at 11 Oct 2017)

                – RickL
                Oct 11 '17 at 13:23















                3














                None of solutions above work for me on owl carousel 2.2.
                I wanted to change stagePadding on init and resize event.



                My solution :



                    var owl = $('.page-item-gal');   
                owl.owlCarousel({
                ...
                onResized : setStagePaddingOC,
                });
                function setStagePaddingOC()
                {
                var carousel = owl.data('owl.carousel');
                var StgPad = ($( window ).width() - owl.parent().parent().find('.width-helper').width()) / 2;
                carousel.settings.stagePadding = StgPad;
                carousel.options.stagePadding = StgPad;
                owl.trigger('refresh.owl.carousel');
                }
                setStagePaddingOC(); // onInitialized doesn't work





                share|improve this answer
























                • Verified this solution works in version 2.2.1.

                  – Jason
                  Apr 18 '17 at 17:13
















                3














                None of solutions above work for me on owl carousel 2.2.
                I wanted to change stagePadding on init and resize event.



                My solution :



                    var owl = $('.page-item-gal');   
                owl.owlCarousel({
                ...
                onResized : setStagePaddingOC,
                });
                function setStagePaddingOC()
                {
                var carousel = owl.data('owl.carousel');
                var StgPad = ($( window ).width() - owl.parent().parent().find('.width-helper').width()) / 2;
                carousel.settings.stagePadding = StgPad;
                carousel.options.stagePadding = StgPad;
                owl.trigger('refresh.owl.carousel');
                }
                setStagePaddingOC(); // onInitialized doesn't work





                share|improve this answer
























                • Verified this solution works in version 2.2.1.

                  – Jason
                  Apr 18 '17 at 17:13














                3












                3








                3







                None of solutions above work for me on owl carousel 2.2.
                I wanted to change stagePadding on init and resize event.



                My solution :



                    var owl = $('.page-item-gal');   
                owl.owlCarousel({
                ...
                onResized : setStagePaddingOC,
                });
                function setStagePaddingOC()
                {
                var carousel = owl.data('owl.carousel');
                var StgPad = ($( window ).width() - owl.parent().parent().find('.width-helper').width()) / 2;
                carousel.settings.stagePadding = StgPad;
                carousel.options.stagePadding = StgPad;
                owl.trigger('refresh.owl.carousel');
                }
                setStagePaddingOC(); // onInitialized doesn't work





                share|improve this answer













                None of solutions above work for me on owl carousel 2.2.
                I wanted to change stagePadding on init and resize event.



                My solution :



                    var owl = $('.page-item-gal');   
                owl.owlCarousel({
                ...
                onResized : setStagePaddingOC,
                });
                function setStagePaddingOC()
                {
                var carousel = owl.data('owl.carousel');
                var StgPad = ($( window ).width() - owl.parent().parent().find('.width-helper').width()) / 2;
                carousel.settings.stagePadding = StgPad;
                carousel.options.stagePadding = StgPad;
                owl.trigger('refresh.owl.carousel');
                }
                setStagePaddingOC(); // onInitialized doesn't work






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 17 '17 at 15:06









                Fabien CharrasseFabien Charrasse

                314




                314













                • Verified this solution works in version 2.2.1.

                  – Jason
                  Apr 18 '17 at 17:13



















                • Verified this solution works in version 2.2.1.

                  – Jason
                  Apr 18 '17 at 17:13

















                Verified this solution works in version 2.2.1.

                – Jason
                Apr 18 '17 at 17:13





                Verified this solution works in version 2.2.1.

                – Jason
                Apr 18 '17 at 17:13











                2














                It looks like the API of Owl 2.0 is a moving target, so the call may depend on what version you're on. For me it's:



                $('.carousel').trigger('changeOption.owl.carousel', {
                mouseDrag: false,
                touchDrag: false,
                pullDrag: false
                });


                But for you it may be something like:



                $('.carousel').trigger('change', { property: { name: 'mouseDrag', value: false } });


                Or



                $('.carousel').trigger('change.owl.carousel', {
                mouseDrag: false,
                touchDrag: false,
                pullDrag: false
                });


                So all together it may look like:



                $('#carousel').on('drag.owl.carousel', function() {
                $('.carousel').trigger('change.owl.carousel', {
                mouseDrag: false,
                touchDrag: false,
                pullDrag: false
                });
                }).on('dragged.owl.carousel', function() {
                $('.carousel').trigger('change.owl.carousel', {
                mouseDrag: true,
                touchDrag: true,
                pullDrag: true
                });
                });





                share|improve this answer




























                  2














                  It looks like the API of Owl 2.0 is a moving target, so the call may depend on what version you're on. For me it's:



                  $('.carousel').trigger('changeOption.owl.carousel', {
                  mouseDrag: false,
                  touchDrag: false,
                  pullDrag: false
                  });


                  But for you it may be something like:



                  $('.carousel').trigger('change', { property: { name: 'mouseDrag', value: false } });


                  Or



                  $('.carousel').trigger('change.owl.carousel', {
                  mouseDrag: false,
                  touchDrag: false,
                  pullDrag: false
                  });


                  So all together it may look like:



                  $('#carousel').on('drag.owl.carousel', function() {
                  $('.carousel').trigger('change.owl.carousel', {
                  mouseDrag: false,
                  touchDrag: false,
                  pullDrag: false
                  });
                  }).on('dragged.owl.carousel', function() {
                  $('.carousel').trigger('change.owl.carousel', {
                  mouseDrag: true,
                  touchDrag: true,
                  pullDrag: true
                  });
                  });





                  share|improve this answer


























                    2












                    2








                    2







                    It looks like the API of Owl 2.0 is a moving target, so the call may depend on what version you're on. For me it's:



                    $('.carousel').trigger('changeOption.owl.carousel', {
                    mouseDrag: false,
                    touchDrag: false,
                    pullDrag: false
                    });


                    But for you it may be something like:



                    $('.carousel').trigger('change', { property: { name: 'mouseDrag', value: false } });


                    Or



                    $('.carousel').trigger('change.owl.carousel', {
                    mouseDrag: false,
                    touchDrag: false,
                    pullDrag: false
                    });


                    So all together it may look like:



                    $('#carousel').on('drag.owl.carousel', function() {
                    $('.carousel').trigger('change.owl.carousel', {
                    mouseDrag: false,
                    touchDrag: false,
                    pullDrag: false
                    });
                    }).on('dragged.owl.carousel', function() {
                    $('.carousel').trigger('change.owl.carousel', {
                    mouseDrag: true,
                    touchDrag: true,
                    pullDrag: true
                    });
                    });





                    share|improve this answer













                    It looks like the API of Owl 2.0 is a moving target, so the call may depend on what version you're on. For me it's:



                    $('.carousel').trigger('changeOption.owl.carousel', {
                    mouseDrag: false,
                    touchDrag: false,
                    pullDrag: false
                    });


                    But for you it may be something like:



                    $('.carousel').trigger('change', { property: { name: 'mouseDrag', value: false } });


                    Or



                    $('.carousel').trigger('change.owl.carousel', {
                    mouseDrag: false,
                    touchDrag: false,
                    pullDrag: false
                    });


                    So all together it may look like:



                    $('#carousel').on('drag.owl.carousel', function() {
                    $('.carousel').trigger('change.owl.carousel', {
                    mouseDrag: false,
                    touchDrag: false,
                    pullDrag: false
                    });
                    }).on('dragged.owl.carousel', function() {
                    $('.carousel').trigger('change.owl.carousel', {
                    mouseDrag: true,
                    touchDrag: true,
                    pullDrag: true
                    });
                    });






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 2 '16 at 15:36









                    BeauBeau

                    1,57011418




                    1,57011418























                        1














                        owl.trigger('refresh.owl.carousel');


                        best option to reinit & update






                        share|improve this answer




























                          1














                          owl.trigger('refresh.owl.carousel');


                          best option to reinit & update






                          share|improve this answer


























                            1












                            1








                            1







                            owl.trigger('refresh.owl.carousel');


                            best option to reinit & update






                            share|improve this answer













                            owl.trigger('refresh.owl.carousel');


                            best option to reinit & update







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Sep 7 '18 at 9:46









                            Chirag PipariyaChirag Pipariya

                            309313




                            309313























                                0














                                yes owl carousel version 2 ..



                                this works for me ( acces options directly )



                                    var $carousel = $('#carousel');
                                var owl = $carousel.data('owlCarousel');

                                w = $( window ).width();
                                var animateStyle = 'fadeOut';
                                if(w <= 768){
                                animateStyle = false;
                                }
                                owl.options.animateOut = animateStyle;





                                share|improve this answer



















                                • 3





                                  It doesn't work for me

                                  – Parhum
                                  Dec 15 '15 at 8:55
















                                0














                                yes owl carousel version 2 ..



                                this works for me ( acces options directly )



                                    var $carousel = $('#carousel');
                                var owl = $carousel.data('owlCarousel');

                                w = $( window ).width();
                                var animateStyle = 'fadeOut';
                                if(w <= 768){
                                animateStyle = false;
                                }
                                owl.options.animateOut = animateStyle;





                                share|improve this answer



















                                • 3





                                  It doesn't work for me

                                  – Parhum
                                  Dec 15 '15 at 8:55














                                0












                                0








                                0







                                yes owl carousel version 2 ..



                                this works for me ( acces options directly )



                                    var $carousel = $('#carousel');
                                var owl = $carousel.data('owlCarousel');

                                w = $( window ).width();
                                var animateStyle = 'fadeOut';
                                if(w <= 768){
                                animateStyle = false;
                                }
                                owl.options.animateOut = animateStyle;





                                share|improve this answer













                                yes owl carousel version 2 ..



                                this works for me ( acces options directly )



                                    var $carousel = $('#carousel');
                                var owl = $carousel.data('owlCarousel');

                                w = $( window ).width();
                                var animateStyle = 'fadeOut';
                                if(w <= 768){
                                animateStyle = false;
                                }
                                owl.options.animateOut = animateStyle;






                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Oct 7 '14 at 8:24









                                Michal OrlíkMichal Orlík

                                41143




                                41143








                                • 3





                                  It doesn't work for me

                                  – Parhum
                                  Dec 15 '15 at 8:55














                                • 3





                                  It doesn't work for me

                                  – Parhum
                                  Dec 15 '15 at 8:55








                                3




                                3





                                It doesn't work for me

                                – Parhum
                                Dec 15 '15 at 8:55





                                It doesn't work for me

                                – Parhum
                                Dec 15 '15 at 8:55











                                0














                                The answers above didnt work for me but this did:



                                var $carousel = jQuery('#owl-carousel-block');
                                var carouselData = $carousel.data();
                                var carouselOptions = carouselData['owl.carousel'].options;
                                carouselOptions.loop = true;
                                $carousel.trigger('refresh.owl.carousel');





                                share|improve this answer




























                                  0














                                  The answers above didnt work for me but this did:



                                  var $carousel = jQuery('#owl-carousel-block');
                                  var carouselData = $carousel.data();
                                  var carouselOptions = carouselData['owl.carousel'].options;
                                  carouselOptions.loop = true;
                                  $carousel.trigger('refresh.owl.carousel');





                                  share|improve this answer


























                                    0












                                    0








                                    0







                                    The answers above didnt work for me but this did:



                                    var $carousel = jQuery('#owl-carousel-block');
                                    var carouselData = $carousel.data();
                                    var carouselOptions = carouselData['owl.carousel'].options;
                                    carouselOptions.loop = true;
                                    $carousel.trigger('refresh.owl.carousel');





                                    share|improve this answer













                                    The answers above didnt work for me but this did:



                                    var $carousel = jQuery('#owl-carousel-block');
                                    var carouselData = $carousel.data();
                                    var carouselOptions = carouselData['owl.carousel'].options;
                                    carouselOptions.loop = true;
                                    $carousel.trigger('refresh.owl.carousel');






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 16 '18 at 16:32









                                    b3wiib3wii

                                    456313




                                    456313






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25339140%2fchange-owl-carousel-2-options-after-setup%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        The Sandy Post

                                        Danny Elfman

                                        Pages that link to "Head v. Amoskeag Manufacturing Co."