Я работаю над сайтом с использованием CRM (drupal) и всплывающей подсказкой для мобильных устройств, я не знаю, как скрыть его, когда я нажму на него снова, это сайт http://www.cfb.it в разделе servizi, всплывающая подсказка отлично подходит для рабочего стола , но когда я пытаюсь получить доступ к веб-сайту с телефона (я пробовал iphone и samsung) и нажимаю на него, появляется всплывающая подсказка, но я не могу скрыть его снова, как только я нажму на него.Как скрыть всплывающую подсказку?
Вот код jquery для этой подсказки, я не знаю, чего не хватает.
(function($) {
$(document).ready(function() {
function tooltipInit() {
var tooltip = jQuery('.tooltip'),
target = jQuery('.icon'),
arrow = jQuery('.arrow-down'),
mobile = jQuery(window).width() < 960,
desktop = jQuery(window).width() > 960
if (mobile) {
jQuery(".overview:odd").addClass('pull-left');
target.click(function() {
target.css({
"background-position": "top"
});
jQuery(this).css({
"background-position": "bottom"
});
tooltip.removeClass('visible');
arrow.removeClass('visible');
jQuery(this).siblings('.tooltip, .arrow-down, .details').addClass('visible');
$this = $(this);
$this.parents('.icons').find('.details').removeClass('mobile-show');
$this.find('.details').addClass('mobile-show');
});
tooltip.click(function() {
jQuery(this).removeClass('visible');
jQuery(this).siblings('.arrow-down').removeClass('visible');
jQuery(this).siblings('.icon').css({
"background-position": "top"
});
});
target.unbind('mouseenter');
target.unbind('mouseleave');
}
if (desktop) {
jQuery('.pull-left').removeClass('pull-left');
target.css({
"background-position": "top"
})
tooltip.removeClass('visible');
arrow.removeClass('visible');
target.bind('mouseenter', function() {
jQuery(this).siblings('.tooltip, .arrow-down').addClass('visible');
jQuery(this).css({
"background-position": "bottom"
});
var removeTooltip = function() {
tooltip.removeClass('visible');
arrow.removeClass('visible');
};
target.bind('mouseleave', removeTooltip);
target.bind('mouseleave', function() {
jQuery(this).css({
"background-position": "top"
});
});
});
}
}
jQuery(window).on("resize", tooltipInit);
jQuery(document).on("ready", tooltipInit);
Эта подсказка подобна этому на этом сайте http://visia.themes.tf/ Я ценю вашу помощь, пожалуйста,
Спасибо за ваш ответ, но приведенный выше код связан с навигационным меню, и от вопроса немного, также он приводит к тому же результату, что и предыдущий. Проблема не в проверке, если устройство мобильное или не проблема, я не могу скрыть всплывающую подсказку после того, как я нажму на нее с мобильного –