twentytwenty icon indicating copy to clipboard operation
twentytwenty copied to clipboard

destroy / reinit / events / hem zone

Open cf-git opened this issue 6 years ago • 0 comments

Hello. Thank you. You done great work.

  1. I'm interesing how i can how i can destroy or reinit your lib.
  • I'm try destroy container with trigger on container
    container.on('destroy.twentytwenty',` function() {
        var $this = $(this);
        beforeImg.css('clip', "");
        afterImg.css('clip', "");
        $this.find('.twentytwenty-overlay').remove();
        $this.find('.twentytwenty-handle').remove();
        $this.find('img')
            .removeClass('twentytwenty-before')
            .removeClass('twentytwenty-after')
            .each(function () {
              this.style.removeProperty('clip');
          });
        $this.unwrap('.twentytwenty-wrapper');
        $this.off('touchmove.twentytwenty')
            .off('mousedown.twentytwenty')
            .off('mouseleave.twentytwenty')
            .off('mousemove.twentytwenty')
            .off("movestart.twentytwenty")
            .off("move.twentytwenty")
            .off("moveend.twentytwenty");
      });

    $this.trigger('destroy');

For this i will add namespace for events which use container. Then i have problems with clip. I can't remove clip from images.

  1. How can i add some reinit method (or function or event)
  • Sometimes i need refresh content on page dinamicaly and possible no need destroy container to renew content
  1. I think there need custom events
  • There, possible, need for events chaining and simplify implementation in/with other code or libraries.
  1. I think possible need implement hem zones but this if from custom events section
  • I mean after and before mouseover zones, to call some events or setted callback function

Thank you!

cf-git avatar Jul 17 '18 07:07 cf-git