2012-08-03 55 views
0

我使用这个插件在这里关闭按钮:创建jSquares插件

http://boedesign.com/blog/2009/10/22/jsquares-for-jquery/

GitHub的链接 https://github.com/jboesch/jSquares/blob/master/js/jquery.jsquares.js

...该脚本工作正常,但我真正需要的是创建一个关闭按钮,只有在标题内部悬停时才显示。

很明显,我不需要桌面网站的关闭按钮,因为它使用悬停,但我需要这个在iPad上更好地工作。我们的解决方案基本上只是在那里有一个关闭按钮,让用户点击手动关闭它。

任何帮助将不胜感激!

编辑 - 我看到这个在那里,所以有一种简单的方法将它附加到标题内的按钮?

.bind('mouseleave', function(){ 
    _fadeInOutImage('out', options.fade_start) 
    $('#js-overlay-id-' + index).remove(); 
    } 
); 

回答

0

我找到了一个体面的方式来做到这一点。

将此代码添加

$('.js-overlay-html .remove').bind('click', function(){ 
    _fadeInOutImage('out', options.fade_start) 
    $('#js-overlay-id-' + index).remove(); 
    return false; 
    } 
); 

后,这直接:

$('<div id="js-overlay-id-' + index + '">' + contents + '</div>') 
    .css(caption_options) 
    .addClass(options._overlay_selector_class) 
    .appendTo('body') 
    .bind('mouseleave', 
    function(){ 
     _fadeInOutImage('out', options.fade_start) 
    $('#js-overlay-id-' + index).remove(); 
    } 
); 

这似乎这样的伎俩。