how can i get the index of the active element when i press one button?
i'm not sure how to implement sly.getIndex( item );
Regards
i call sly like this..
<script type="text/javascript">
$(document).ready(function(){
'use strict';
(function () {
var $frame = $('#frame-fleet');
var $slidee = $frame.children('ul').eq(0);
var $wrap = $frame.parent();
// Call Sly on frame
$frame.sly({
horizontal: 1,
itemNav: 'forceCentered',
smart: 1,
activateMiddle: 1,
activateOn: 'click',
mouseDragging: 1,
touchDragging: 1,
releaseSwing: 1,
startAt: 0,
scrollBar: $wrap.find('.scrollbar'),
scrollBy: 1,
speed: 1000,
elasticBounds: 1,
easing: 'easeOutExpo',
dragHandle: 1,
dynamicHandle: 1,
clickBar: 1,
// Buttons
prev: $wrap.find('.prev'),
next: $wrap.find('.next')
});
$('#select-ship').on('click', function () {
var position = $frame.sly.rel.activeItem;
alert (position);
});
}());
});
</script>
the sly works great, but i'm going crazy to take out the index of the active item
regards
on this way nothing goes to var position.
Please, you have a lot of documentation, i read and read but if the solution it's there, i can not find it.
it's so hard to you write 2 code lines to help me?.
I think it's easy to solve, but i can't do it myself.
Thank you.
var sly = new Sly( frame, options [, callbackMap ] ).init();
sly.rel.activeItem
this works
$frame.sly('on', 'active', function () {console.log( $frame.sly('rel.activeItem') )});
that shows me on the console log an array
but now i need to put the current index on a var
i keep trying
<script type="text/javascript">
$(document).ready(function(){
var sly = new Sly("#marco-nave",
{
horizontal: 1,
itemNav: 'forceCentered',
smart: 1,
activateMiddle: 1,
activateOn: 'click',
mouseDragging: 1,
touchDragging: 1,
releaseSwing: 1,
startAt: 0,
scrollBar: $wrap.find('.scrollbar'),
scrollBy: 1,
speed: 1000,
elasticBounds: 1,
easing: 'easeOutExpo',
dragHandle: 1,
dynamicHandle: 1,
clickBar: 1,
// Buttons
prev: $wrap.find('.prev'),
next: $wrap.find('.next')
}).init();
});
</script>
but the result is an dead frame,:-(
where is the mistake? i'm going crazyyyy
I init all to take and use all the Sly powerful
I hope this helps to people....
--------------------------------------------------
$(document).ready(function(){
var sly = new Sly('#marco-nave',
{
horizontal: 1,
itemNav: 'forceCentered',
smart: 1,
activateMiddle: 1,
activateOn: 'click',
mouseDragging: 1,
touchDragging: 1,
releaseSwing: 1,
startAt: 0,
scrollBar: $('#marco-nave').find('.scrollbar'),
scrollBy: 1,
speed: 1000,
elasticBounds: 1,
easing: 'easeOutExpo',
dragHandle: 1,
dynamicHandle: 1,
clickBar: 1,
// Buttons
prev: $('#prev'),
next: $('#next')
});
sly.init();
sly.on('change', function (eventName) {
console.log(eventName); //
console.log(this.rel.activeItem);
});
});
--------------------------------