BeefUp icon indicating copy to clipboard operation
BeefUp copied to clipboard

Feature Request: "is-opening" & "is-closing" class.

Open regiside opened this issue 1 year ago • 1 comments

Thanks for this great plugin! I'd like the carrot to start animating as soon as the accordion is clicked, but it doesn't get the "is-open" class till the animation has finished. Could there be a option to make it get the class right when it's clicked, or add classes that indicate when the item is opening and closing. I could then just add these to my css selectors for the open and close states and it would solve the problem.

regiside avatar Oct 23 '24 21:10 regiside

A workaround for the time being is adding this script...

jQuery(".beefup__head").on('click', function(event){
  
  if(jQuery(this).parent().hasClass('is-open')) {
    jQuery(this).parent().addClass('closing');
  }else {
    jQuery(this).parent().addClass('opening');
  }
  
});

and then using beefup to remove the classes once toggling has finished...

jQuery('.beefup').beefup({
      onClose: function ($this) {
        $this.removeClass('closing');
      },
      onOpen: function ($this) {
        $this.removeClass('opening');
      },
      etc…
    });

regiside avatar Nov 06 '24 22:11 regiside