This site demos Social Sharing code such as 'share to Facebook'. Here, clicking the links on the left opens the sharing in a modal window. Their code:
<!-- Facebook -->
<a href="http://www.facebook.com/sharer.php?u=https://simplesharebuttons.com" target="_blank">
<img src="https://simplesharebuttons.com/images/somacro/facebook.png" alt="Facebook" />
</a>
I want a similar effect and I have the following anchor
but this opens in a new tab . I want it to open in a modal window :
<a href="http://www.facebook.com/sharer.php?u=http://www.idybrand.com/" title="Share on Facebook" target="_blank" >
<img alt="Share on Facebook" width="40" height="40" src="img/social_media/facebook.svg">
</a>
How can I achieve this please? Possibly using Bootstrap?
Replace your code with this::
<a href="http://www.facebook.com/sharer.php?u=http://www.idybrand.com/" title="Share on Facebook" target="popup" onclick="window.open('http://www.facebook.com/sharer.php?u=http://www.idybrand.com/','popup','width=600,height=600'); return false;">
<img alt="Share on Facebook" width="40" height="40" src="img/social_media/facebook.svg">
</a>
It will work..
You can use this. I hope it helps.
<a onclick="window.open('https://www.facebook.com/','mywindow','width=640,height=360')" href="javascript:void(0)"><button>Click FB</button></a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.