codrops / Elastislide

Elastislide is a responsive image carousel that will adapt fluidly in a layout. It is a jQuery plugin that can be laid out horizontally or vertically with a pre-defined minimum number of shown images
362 stars 111 forks source link

Issue with SetCurrent, undefined is not a function #38

Open imaginaryflash opened 9 years ago

imaginaryflash commented 9 years ago

I have a Elastislide setup on my site with 10-15 thumbnails. The slider works great, everything is right where I want it, but I cannot get a function to work.

Here is what I am trying to do:

spThumbSlider = $('#carousel').show().elastislide({
    orientation : 'vertical',
    minItems : 5, 
    onClick : function( $item ) {
        spThumbSlider.setCurrent($item.index());
    }
}); 

Whenever I do that, I receive a console error that undefined is not a function. I've tried a few of the other functions, same issue.

I have other images on the page that call a click on the carousel thumbnail when hovered. That part works great. The script finds the image in the thumbnails, sets it to active, and "clicks" it. I just need the slider to slide to the image.

What am I doing wrong?

imaginaryflash commented 9 years ago

Nevermind, the min.js version worked perfectly.

MikeSha commented 9 years ago

I have the same issue. Could you please tell me how to fix it?

imaginaryflash commented 9 years ago

Mine is working fine like this:

spThumbSlider = $('#carousel').show().elastislide({ orientation : 'vertical', minItems : 5, });

I then call setCurrent using:

spThumbSlider.setCurrent(i);

I’ve had no issues with it.

From: MikeSha [mailto:notifications@github.com] Sent: Wednesday, May 20, 2015 9:59 AM To: codrops/Elastislide Cc: Brandon Dowd Subject: Re: [Elastislide] Issue with SetCurrent, undefined is not a function (#38)

I have the same issue. How to fix it?

— Reply to this email directly or view it on GitHubhttps://github.com/codrops/Elastislide/issues/38#issuecomment-103896928.

MikeSha commented 9 years ago

Thanks, but it doen't work for me :(

imaginaryflash commented 9 years ago

Now that I think about it, I may have modified the .js file to get it to work.

Not sure how I can send you mine to test though.

From: MikeSha [mailto:notifications@github.com] Sent: Wednesday, May 20, 2015 10:18 AM To: codrops/Elastislide Cc: Brandon Dowd Subject: Re: [Elastislide] Issue with SetCurrent, undefined is not a function (#38)

Thanks, but it doen't work for me :(

— Reply to this email directly or view it on GitHubhttps://github.com/codrops/Elastislide/issues/38#issuecomment-103902965.

MikeSha commented 9 years ago

Thank you. I'll try

trentmillar commented 8 years ago

This seems to be a problem with JQuery's each function, I had this issue using jquery version 1.10.x. I decided to use another approach so I am not continuing with this library so I didn't dig further.

Not recommended but a quick hack is if you have only a single Elastislide on your page, you could remove the $.each() and directly call the inner callback within the plugin constructor: $.fn.elastislide(...)

Hopefully a Elastislide contributor will fix this properly.