Skip to content

Commit

Permalink
Fix ApmButton margin condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrosilva-pt committed Dec 12, 2023
1 parent ec0dd52 commit c59f6de
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions modules/ppcp-button/resources/js/modules/Helper/ApmButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,18 @@ export class ApmButtons {
}

// Check first apm button
const $firstApmButton = $container.find(this.selector + ':visible').first();
const $firstElement = $container.children(':visible').first();

let isFirstElement = false;
if ($firstApmButton.is($firstElement)) {
isFirstElement = true;
}

// Assign margins to buttons
$container.find(this.selector).each((index, el) => {
const $el = jQuery(el);
const height = $el.height();

if (isFirstElement) {
if ($el.is($firstElement)) {
$el.css('margin-top', `0px`);
return true;
}

const height = $el.height();
$el.css('margin-top', `${Math.round(height * 0.3)}px`);
});

Expand Down

0 comments on commit c59f6de

Please sign in to comment.