Code Monkey home page Code Monkey logo

Comments (5)

fazeaction avatar fazeaction commented on May 21, 2024

For the moment I dont know why but add this line after line 157. It's working for me:

if($.reel.instances.length>0) remove_instance($.reel.instances.first());

Excerpt:

on= {
setup: function(e){
/*
- fills up the data storage with values based on options
- binds to ticker
*/
if (t.hasClass(klass)) return cleanup.call(e);
if($.reel.instances.length>0) remove_instance($.reel.instances.first());

from reel.

zazoomauro avatar zazoomauro commented on May 21, 2024

Works!!!

from reel.

pisi avatar pisi commented on May 21, 2024

First, Fazeaction,

first of all let me thank you very much! It's pretty cool that you literally found the issue here. I long had no clue what might be wrong with the code, but now I think I'm starting to get it, thanks to you. Your solution very clearly uncovers, that the problems experienced are a logical consequence of not having the instance properly removed from the DOM.

Your solution for this is indeed very right and I can not thank you enough for helping out and bumping me on the right track. It unfortunatelly won't do the trick for multiple Reel instances on the page simultaneously.

Zazoomauro,

The "teardown" event will come handy in situations like these, where you i.e. dynamically dynamically build (and destroy) instances, like loading one Reel in place of another. It removes the existing DOM node and all its data and event bindings by restoring the original image element Reel was built upon. It performs all necessary cleanup for you, including the call to remove_instance for example.

So instead of the proposed Reel modification, putting this:

$('.imageReel').trigger('teardown`)

just before the .load call would be the recommended solution for your code.

Thank you, guys, for cooperating on the solution here on Github :) You both have helped!

from reel.

pisi avatar pisi commented on May 21, 2024

This issue qualified for frequently asked question and has become part of the FAQ wiki page.

from reel.

marissajmc avatar marissajmc commented on May 21, 2024

Thanks fazeaction, that new line worked for me when loading a Reel instance with ajax on click.

.trigger('teardown') did not work in this case.

from reel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.