Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with "destroy" cycle #5

Open
fazedesigns opened this issue Apr 8, 2021 · 8 comments
Open

Issue with "destroy" cycle #5

fazedesigns opened this issue Apr 8, 2021 · 8 comments

Comments

@fazedesigns
Copy link

fazedesigns commented Apr 8, 2021

Hi, this is so great you are keeping cycle2 alive!

I am having an issue when I destroy a slideshow.
I am trying to change the carousel visible count on different size screens:

var width = $(window).width(); // Checking size again after window resize
if ( width < 768 ) {
$('.carousel_logos').cycle( "destroy" );
$('.logo_block .carousel_logos').cycle({
carouselVisible : 2,
autoHeight : 0
});
}

I am then getting this error:

jQuery.Deferred exception: this.varType is not a function. (In 'this.varType( $._data )', 'this.varType' is undefined) (2)

line 990
var clean = (this.varType($._data) === 'function') ? $._data : $.noop;

Is this an issue? Or am I doing this wrong?
Thanks!

@iam-sysop
Copy link
Owner

iam-sysop commented Apr 8, 2021

It appears that is a bug introduced when I attempted to remove a deprecated jQuery function from the original code.

Please check the version you are using to be sure - as well as the version of jQuery you might be running on just to be sure, and I will look at what I did wrong in the code!

To mitigate if this is the case, attempting to use the 2.1.6b version on the releases page MIGHT resolve the issue -- https://github.com/thecarnie/cycle2/releases/tag/2.1.6b (but it will require jQuery-Migrate if you are running on jQuery 3+

@fazedesigns
Copy link
Author

I changed to 2.1.6b and added jQuery Migrate. I am using jQuery 3.5.1 too.
It is now showing different errors.
It seems the "destroy" worked but will not re-build the slider.

jQuery.Deferred exception: undefined is not an object (evaluating 'opts._carouselWrap.remove') (2)

Carousel Extension - line 265
opts._carouselWrap.remove();

@iam-sysop
Copy link
Owner

Ok - so it's most likely not actually the new mitigations in 2.1.6c but an issue with the carousel plugin itself.

If I remember right, I had an issue with Destroy and Init in the past. Let me look at a site I have and see what I did for that -- maybe there's a fix hidden in there for the code to bring it in line.

Thanks a lot for your help sorting through this!

@fazedesigns
Copy link
Author

Your welcome!

I just tried this with 2.1.6b and there are no errors but the cycle does not Init after destroying.

$('.block_hero .cycle-slideshow').cycle( "destroy" );
$('.block_hero .cycle-slideshow').cycle({
timeout : 700
});

This is not using carousel so I am not sure if that helps.

@fazedesigns
Copy link
Author

Hi, Did you happen to find that fix for Init after Destroy?
Thanks!

@iam-sysop
Copy link
Owner

iam-sysop commented May 9, 2021 via email

@iam-sysop
Copy link
Owner

Re: init not working after destroy - this issue I have ran into before - I am hunting through previous websites I have used the plugin on because I wrote a work-around into that site, and it needs to be included in the plugin (or at least documentation).

I apologize for the delayed fix -- there have been a couple "life curveballs" thrown at me over the last couple weeks but things are starting to get back to normal.

@flyt3dev
Copy link

@iam-sysop was there ever a fix for the destroy issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants