Pergunta

I implemented pin it button successfully and it works fine, just it does not open in pop up, it's opening new page. I want it open in pop up window.

Here is my code:

jQuery("#i-cell-" + cnt_rows + "-" + cnt_cells+page)
    .append($("<div>")
    .append($("<a href='//pinterest.com/pin/create/button/?url=https://www.facebook.com/ElmSandBox/app_338950576241266/&media="+encodeURIComponent(items[cnt].item_img)+"&description=Next%20stop%3A%20Pinterest' data-pin-do='buttonPin' target='_top' data-pin-config='above' onclick='storePinterest(\""+items[cnt].item_id+"\")'><img src='//assets.pinterest.com/images/pidgets/pin_it_button.png' /></a>")));
Foi útil?

Solução

Replace target='_top' with target=_blank.

That will open a new window.

If you want a more traditional popup (i.e. smaller, no navigation bar, etc.), you should use some code similar to this (from here)

<script type="text/javascript">
// Popup window code
function newPopup(url) {
    popupWindow = window.open(
        url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>
<a href="JavaScript:newPopup('http://YOUR URL HERE');">Pin it!</a>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top