@mercmarcus

Как убрать лишнюю кнопку?

Есть плагин переводчик. Сделал шорткод. Работает нормально, но там есть кнопка (А) и чтобы сделать перевод сначала нужно нажимать на "А" и потом появляется кнопка. Хочу убрать кнопку "А". То есть хочу увидеть кнопку перевода без свитка. Ниже код.

PHP код:
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 код:

#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 код:

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();
	}
});
  • Вопрос задан
  • 93 просмотра
Решения вопроса 1
Fqyeh29
@Fqyeh29
↓ ИМХО ↓
В css коде заменить kirilldan_lotinga_oyna на этот. Т.е display:none убрать просто. Ну и кнопку А убрать потом.

#kirilldan_lotinga_oyna {
  position:fixed;
  z-index:999;
  bottom:0px;
  right:250px;
  padding:10px;
  background:#ffffff;
}
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы