Search code examples
jqueryclonejquery-toolsaddclass

navigation on jquery-tools scrollable always disable


I can't get the scrollable navigation to work, when I'm cloning the DIVS it should fire. I want the scroll to start when the divs are cloned.

any idea?

http://jsfiddle.net/2mby5/13/

or

var cloneCount = 0;
$("#add-address").click(function() {

     $("#to-add-address").clone()
        .attr("id", "to-add-address_Clone" + cloneCount)
        .insertAfter("#to-add-address").addClass('cloned');  //add a new class cloned to the cloned outerDivs
    $(".clone", "#to-add-address_Clone" + cloneCount)
        .attr("id", "clone_Clone" + cloneCount);
    cloneCount++;
     $('#scroll-addresses').scrollable();
});



$(document).on("click", '.options li a',function () {
            $(this).closest(".options").find('li a').removeClass('selected');
            $(this).addClass('selected');

        });
$(document).on("click", 'li.delete',function () {
            $(this).closest(".outerDiv").filter('.cloned').remove(); // and delete only the cloned ones
    if ($(this).is(".outerDiv:last")){
            return false;
    }   
});

 ​

Solution

  • "You must have a root element for the scrollable and inside that another wrapper element for the items."

    http://jquerytools.org/demos/scrollable/index.html