Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
76
rated 0 times [  77] [ 1]  / answers: 1 / hits: 19671  / 8 Years ago, sun, april 3, 2016, 12:00:00

I have a owl carousel with 3 items, the carousel displays one item per page.
Inside each item I have html inputs.



I want to programmatically change the active item so I can make focus on input inside it.



Here is the initial configuration:



var owl = $(#selector).owlCarousel({
slideSpeed: 300,
paginationSpeed: 400,
items: 1,
itemsDesktop: false,
itemsDesktopSmall: false,
itemsTablet: false,
itemsMobile: false,
dots: false,
touchDrag: false,
mouseDrag: false
});


And the html looks like this:



<div id=selector class=owl-carousel owl-theme>
<div class=item>
<input type=text name=name1 id=input1>
</div>

<div class=item>
<input type=text name=name2 id=input2>
</div>

<div class=item>
<input type=text name=name3 id=input3>
</div>
</div>


For example: if I want to make focus on input3, I have to set the current page to 3 and then set the focus.


More From » jquery

 Answers
16

to.owl.carousel the event goes to a position.



Parameter: [position, speed]



$(#selector).trigger(to.owl.carousel, [2, 1])


As per the events docs: http://owlcarousel2.github.io/OwlCarousel2/docs/api-events.html


[#62710] Thursday, March 31, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
beatriceisabelad

Total Points: 710
Total Questions: 107
Total Answers: 99

Location: Cayman Islands
Member since Sat, Sep 17, 2022
2 Years ago
beatriceisabelad questions
Fri, Apr 2, 21, 00:00, 3 Years ago
Fri, Jun 19, 20, 00:00, 4 Years ago
Tue, Dec 3, 19, 00:00, 5 Years ago
Wed, Oct 16, 19, 00:00, 5 Years ago
;