2016-04-07 80 views
0

我正在使用CRM(drupal)和移動工具提示網站工作,我不知道如何隱藏它,當我再次點擊它時,這是網站http://www.cfb.it在servizi部分工具提示工作正常,但是當我嘗試從手機訪問網站(我試過iphone和三星)並點擊它時,出現了工具提示,但是一旦我點擊它,我就無法再隱藏它。如何隱藏工具提示?

下面是這個工具提示的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/ 我會感謝你的幫助,請

回答

1

你好請使用下面的代碼跟蹤如果devide是移動設備還是不那麼執行代碼

if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 
// some code.. 
} 
+0

感謝您的回答,但上面的代碼與導航菜單有關,遠離問題一點點,也導致與前一個相同的結果。問題是不檢查設備是否移動或不是問題是我無法隱藏工具提示後,我從手機上點擊它 –