Custom share on twitter button (<li> element) with "tweet" bind


#1

I have this HTML:

  • {share icon}

when i click on the twitter icon element i need to open the “share on twitter” window i use this js for do that:

$("ul .twitter").on("click", function(e){ share.onTwitter(); }); share: { onTwitter : function(url, title){ window.open("https://twitter.com/intent/tweet?url="+encodeURIComponent(url)+"&text="+encodeURIComponent(title)+ "&count=none/", "", "height=300, width=550, resizable=1"); return true; } }

end i try to bind the “tweet” event:

(include the twitter widget JS)

twttr.ready(function (twttr) {
twttr.events.bind(‘tweet’, function (event) {
console.log(“tweet”);
});
});

With this code i try to fire a function on tweet event for send to my DB the twitter share counter… but… my script never enter in the “tweet” handler!
How can i do that?!
(the window opens correctly end i can tweet my page)

Thx Mate.
Simone


#2

EDIT:
hi guys,
with some search I understand that the only way to trigger this event after twitter share is call the twitter share window using this html:

{icon}

with this HTML the share window is automatically open end when you click “share” the twitter js trigger the “tweet” eventi…

I change my HTML:

  • {icon}
  • Now the event “tweet” was triggered and I can bind it… but… this isn’t the way i like to done that.

    I’d like to use old html syntax:

  • {icon}
  • :frowning: help?


    #3

    #4

    #5

    #6