Dudaevskiy
8/18/2019 - 1:26 AM

WordPress search-and-navigation-popup Полезности

// ========================================================================================
// search-and-navigation-popup - При клике на овердей скрываем попап окно поиска
// START
// ========================================================================================
jQuery(document).ready(function($) {
$('body').bind('click', '.custombox-content.custombox-fullscreen:not(.sanpop-search-box)',function(event) {
	// Для того что бы исключить скрытие формы при клике по Input'у
	// Вычисляем ID родителя при клике на оверлей (Ну и он отличается от ID родителя при клике в Input или кнопку отправки)
    // 	console.log(event.target.id);
	var ParrentOverley = event.target.id;
	if (ParrentOverley == 'sanpop-modal-1'){
		// console.log('👍 Да был клик по оверлею, можно скрывать окно поиска');
		// Юзаем функцию закрытия попап окна от самого плагина
		Custombox.modal.close();
	}
});
});

// Triggers click
jQuery(document).ready(function ($) {
    // SEARCH
    $('body').on('click','li.sanpop-link.custom-search-targget.menu-item', function(){
        $('span.SDStudio-This-Hiden-SEARCH a').trigger('click');
    });
    // MENU
    $('body').on('click','li.sanpop-link.custom-menu-targget.menu-item', function(){
        $('span.SDStudio-This-Hiden-POPUPMENU a').trigger('click');
    });
});
// ========================================================================================
// END
// search-and-navigation-popup - При клике на овердей скрываем попап окно поиска
// ========================================================================================
<?
add_action( 'wp_footer', 'hiden_Search_and_Navigation_Popup' );
function hiden_Search_and_Navigation_Popup() {
    if ( is_singular() ) {
        ?>
        <span class="SDStudio-This-Hiden-SEARCH" style="display:none">
        <?php echo do_shortcode('[serach-popup]'); ?>
    </span>
        <span class="SDStudio-This-Hiden-POPUPMENU" style="display:none">

        <?php echo do_shortcode('[menu-popup]'); ?>

    </span>
        <?php
    }
}
/* Указываем шрифт */
.custombox-content.custombox-fullscreen form#searchform,
.custombox-content.custombox-fullscreen input#s  {
    font-family: Alegreya Sans !important;
}

/* Оформление кнопки */
.custombox-content.custombox-fullscreen button.search-btn {
    font-family: Alegreya Sans;
    font-size: 25px;
    background-color: rgb(35,64,130) !Important;
    padding: 10px 25px 10px 25px !Important;
    border:2px solid  rgb(35,64,130) !Important;
}

.custombox-content.custombox-fullscreen button.search-btn:hover {
    background-color: rgb(255, 255, 255) !Important;
    color:rgb(35,64,130) !Important;
    padding: 10px 25px 10px 25px !Important;
    border:2px solid  rgb(35,64,130) !Important;
}

/* Запрещяем скрытие скрола во время открытия попапа */
.custombox-lock {
    overflow: inherit !important;
}

/* Затемняем фон оверлея */
.sanpop-modal {
    background: rgba(11, 22, 49, 0.88) !important;
}

/* Курсор при наведении на пункты меню - заменители */
li.sanpop-link {
    cursor: pointer;
}
<a href="https://techblog.sdstudio.top/wp-content/uploads/2020/06/search-and-navigation-popup_languages.zip">RU,UK,EN</a>
Ссылка
javascript:void(0);

Текст ссылки:
<i class="fa fa-hand-o-right"></i>
class:
sanpop-link custom-menu-targget


Текст ссылки:
<i class="fa fa-search"></i>
class:
sanpop-link custom-search-targget