jQuery目标LinkedIn共享按钮 [英] jQuery target LinkedIn share button

查看:84
本文介绍了jQuery目标LinkedIn共享按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个LinkedIn共享按钮,我需要以jQuery为目标来保存共享的内容等.我对Twitter也做了同样的事情,它具有用于捕获事件的api,但是LinkedIn存在问题.由于它不是iframe,因此我认为我可以捕获事件.这是初始代码:

I have a LinkedIn share button which I need to target with jQuery to save what content was shared etc. I've done the same with Twitter, which has an api for capturing events, but I'm having a problem with LinkedIn. Since it's not an iframe, I figured I can catch events. This is the initial code:

<li id="linkedin-share">
    <script src="//platform.linkedin.com/in.js" type="text/javascript">
        lang: en_US
    </script>
    <script type="IN/Share"></script>
</li>

因此,共享工作正常,但我无法捕获点击.我设法在Chrome DevTool的控制台中捕获了呈现的html元素,但没有设法捕获点击.我已经尝试过这样的事情:

So, sharing works fine, but I can't capture the click. I've managed to capture the rendered html elements in Chrome DevTool's console, but I didn't manage to capture a click. I've tried something like this:

$('<fixed parent>').on('click', '<rendered content catchable in devtools>', function(){
    console.log('captured');
});

任何想法,有一些预定义的方法可以做到这一点吗?

Any ideas, is there some predefined way to do this?

推荐答案

<script type="IN/Share" data-onSuccess="shared"></script>

function shared(){
     console.log('shared');
}

hacky解决方案

jQuery('#tester').click(function(){

    //share function here!
    IN.UI.Share().params({
    url: "http://www.example.com"
    }).place()
});

链接到文档: https://developer.linkedin.com/documents/inauth-inevent-and-uii 不幸的是,没有成功共享的事件.

Link to docs: https://developer.linkedin.com/documents/inauth-inevent-and-inui unfortunately no event for successful share.

这篇关于jQuery目标LinkedIn共享按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆