Advertisement
Guest User

Untitled

a guest
May 29th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. // Share Popup
  2. share = (function () {
  3.  
  4. function popup(container) {
  5.  
  6. var share,
  7. winWidth = (screen.width / 2),
  8. winHeight = (screen.height / 2),
  9. winTop = (screen.height / 2) - (winHeight / 2),
  10. winLeft = (screen.width / 2) - (winWidth / 2);
  11.  
  12. $('.icons', container).on('click', function () {
  13. if ($(this).hasClass('icon__fbk')) {
  14. share = 'https://facebook.com/sharer.php?u=' + $(this).data('url');
  15. }
  16. if ($(this).hasClass('icon__twt')) {
  17. share = 'https://twitter.com/intent/tweet?text=' + $(this).data('text') + '&via=' + $(this).data('via') + '&url=' + $(this).data('url');
  18. }
  19. if ($(this).hasClass('icon__gpl')) {
  20. share = 'https://plus.google.com/share?url=' + $(this).data('url');
  21. }
  22. window.open(share, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
  23. return false;
  24. });
  25. }
  26.  
  27. return {
  28. popup: popup
  29. };
  30.  
  31. }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement