我正在使用 jQuery Sharrre plugin显示总计
我试图隐藏计数器,使其不显示计数是否小于(例如总股数 100)。这是我的演示:JSFIDDLE
代码如下:
HTML
<div id="demo1" data-url="http://sharrre.com/" data-text="Make your sharing widget with Sharrre (jQuery Plugin)" data-title="share"></div>
Javascript
$('#demo1').sharrre({
share: {
googlePlus: true,
facebook: true,
twitter: true
},
hide: function(api, options){
var count = $(api.element).find('.count').val();
if(count < 100 ) {
$(api.element).find('.count').hide();
}
},
enableHover: false
});
它有两个问题:
如果计数 > 100,则会显示计数,但当您将鼠标悬停在其上方时,计数会消失。
如果计数 < 100,计数仍会显示。
有人可以指导我吗?我被困住了。
最佳答案
您正在进行的计数不正确。 API指定的方式是你必须通过选项来完成。另外,我认为您想在加载时执行此操作,因此我将事件更改为渲染。希望有帮助!
render: function(api, options){
var count = options.count.facebook + options.count.googlePlus + options.count.twitter;
if(count < 100 ) {
$(api.element).find('.count').hide();
}
所以看看这个更新的 fiddle ,你就会明白。
关于javascript - 如何在 Sharrre 插件中隐藏总分享数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21756625/