M
M
mercmarcus2022-03-26 17:59:05
PHP
mercmarcus, 2022-03-26 17:59:05

How to remove the extra button?

There is a translator plugin. Made a shortcode. It works fine, but there is a button (A) and to make a transfer, you first need to press "A" and then the button appears. I want to remove the "A" button. That is, I want to see the translate button without the scroll. Below is the code.

PHP code:

add_shortcode( 'head_bar' , 'kirilldan_lotinga_script' );
add_action('wp_enqueue_scripts', 'kirilldan_lotinga_style');

function kirilldan_lotinga_script() {
  $htmlOutput = '<button id="kirilldan_lotinga" class="button button-primary" onclick="kirilldanLotingaOyna()">A</button>
    <div id="kirilldan_lotinga_oyna">
       <button id="kirilldan_lotinga_lat" class="button button-primary" onclick="kirilldanLotingaTugma()">Kirill</button>
       <button id="kirilldan_lotinga_cyr" class="button button-primary" onclick="kirilldanLotingaTugma()">Лотин</button>
    </div>';
    echo $htmlOutput;
  wp_register_script('kirilldan-lotinga', plugins_url('kirilldan-lotinga.js', __FILE__), '', '', true);
  wp_enqueue_script('kirilldan-lotinga');
}
function kirilldan_lotinga_style() {
  wp_register_style('kirilldan-lotinga', plugins_url('kirilldan-lotinga.css', __FILE__));
  wp_enqueue_style('kirilldan-lotinga');

}


CSS code:

#kirilldan_lotinga {
  position:fixed;
  z-index:999;
  bottom:10px;
  right:200px;
}
#kirilldan_lotinga_oyna {
  position:fixed;
  z-index:999;
  bottom:0px;
  right:250px;
  padding:10px;
  background:#ffffff;
  display:none;
}
#kirilldan_lotinga_lat,
#kirilldan_lotinga_cyr {
  display:none;
}


js code:

function kirilldanLotingaOyna() {
  jQuery("#kirilldan_lotinga_oyna").fadeIn();
}
function kirilldanLotingaTugma(){
  if (localStorage["alphabet"] !== "lat") {
    localStorage["alphabet"] = "lat";
    doIt();
    jQuery("#kirilldan_lotinga_cyr").hide();
    jQuery("#kirilldan_lotinga_lat").show();
  } else {
    localStorage["alphabet"] = "cyr";
    location.reload();
  }
};

jQuery(document).ready(function(){
    if (localStorage["alphabet"] == "lat") {
    doIt();
    jQuery("#kirilldan_lotinga_lat").show();
    jQuery(document.body).fadeIn();
  } else {
    localStorage["alphabet"] = "cyr";
    jQuery("#kirilldan_lotinga_cyr").show();
    jQuery(document.body).fadeIn();
  }
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ainur Shakirov, 2022-03-26
@mercmarcus

In css code replace kirilldan_lotinga_oyna with this one. That is, display: none is easy to remove. Well, then remove the A button.

#kirilldan_lotinga_oyna {
  position:fixed;
  z-index:999;
  bottom:0px;
  right:250px;
  padding:10px;
  background:#ffffff;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question