darsain / sly

JavaScript library for one-directional scrolling with item based navigation support.
http://darsa.in/sly
2.87k stars 497 forks source link

.add method not working for me #225

Closed chrisplusplus closed 8 years ago

chrisplusplus commented 8 years ago

I can get the slider to initialize and work as expected, but I cannot get it to dynamically add an item. What am I doing wrong here? Using version 1.6.1 var $frame_un = spm._containerUnassignedCategories; var $wrap_un = $frame_un.parent();

    // Call Sly on frame
    $frame_un.sly({
        horizontal: 1,
        itemNav: 'basic',
        smart: 1,
        activateMiddle: 1,
        activateOn: 'click',
        mouseDragging: 1,
        touchDragging: 1,
        releaseSwing: 1,
        startAt: 0,
        scrollBar: $wrap_un.find('.scrollbar'),
        scrollBy: 1,
        speed: 300,
        elasticBounds: 1,
        easing: 'easeOutExpo',
        dragHandle: 1,
        dynamicHandle: 1,
        clickBar: 1,

        // Buttons
        prev: $wrap_un.find('.backward'),
        next: $wrap_un.find('.forward')
    });
            //add an item
            $frame_un.add('<li>test</li>'); //doesn't work
darsain commented 8 years ago

$frame_un in your example is not a sly instance. It's a jQuery object holding some frame UL element I assume.

For more info how to initiate and use Sly instances, see the Calling part of the documentation.