WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WP Socializer] Pinterest – Button does not popup, it takes current tab/window (My Fix)

[Plugin: WP Socializer] Pinterest – Button does not popup, it takes current tab/window (My Fix)

  • alegadpen
    Member

    @alegadpen

    Howdy! I noticed that when you click the pinterest button it does not open a popup, but takes the whole current tab/window to display the pin it functionality.
    However, I made this work! =) YAY!!
    Case: Template Tags
    I wrapped the button template tag code into a div which has a class .social-button-pinit, now in a jQuery/javascript init file (ya know, the one that you place all your custom jquery code) i inserted this…

    $j(".social-button-pinit").click(function(){
         var pinitlink = $(this).find("a").attr("href");
    		 window.open(pinitlink, 'Pinterest', 'width=600,height=280,scrollbars=no,toolbar=no,location=no,menubar=no');
         	return false;
    		});

    And now you can see the button working like a charm!!
    The site I made this fix: Vidal
    Follow me on Twitter: @alegadpen

    http://wordpress.org/extend/plugins/wp-socializer/

Viewing 1 replies (of 1 total)
  • stevelacey
    Member

    @stevelacey

    I doubt this is appropriate here considering the button code provided by Pinterest doesn’t open in a popup, regardless, made a slight improvement to your code for my own uses, slightly more efficient selector (no need to wrap in div), closure, and popup opens in center of window.

    $('.pin-it-button').click(function (e) {
      (function (url, title, w, h) {
        var left = (screen.width/2)-(w/2);
        var top = (screen.height/2)-(h/2);
        return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
      })($(this).attr('href'), 'Pinterest', 600, 280);
    
      e.preventDefault();
    });

    Also note: Don’t use return false to preventDefault action, that will also prevent event bubbling in jQuery and could potentially break other things.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP Socializer] Pinterest – Button does not popup, it takes current tab/window (My Fix)’ is closed to new replies.