When you installs Divi, there are some social icons in header and footer. And whenever we click on those icons, it opens the social links in a same tab of the browser. We can let these social links open in a new tab or window.
Let’s see how to do this,
- Please go to the Integration Tab of the Divi theme options
- Find a field called “Add code to the <Head>”
- And paste the given code inside.
1 2 3 4 5 6 7 8 9 10 11 |
<script type="text/javascript"> (function($) { $(document).ready(function() { $('.et-social-icons .et-social-icon a').click(function(e) { e.preventDefault(); var url = $(this).attr('href'); window.open(url, '_blank'); }); }); })(jQuery); </script> |
And then save the changes. Now if you click on social icons then you find that it will open in a new tab.
Hope this will help, if you have any query or any suggestion then you can leave a comment, we will be happy to assist you. Please check more useful articles on http://www.elegantenthusiast.com/.
Beautiful!!! It works like magic! Thank you for sharing this! I’m much happier now! ๐
Any ideas on how to get the social media icons in Divi’s Person Module to open in new tab?
Hello @Drew
Please refer here: http://www.elegantenthusiast.com/social-media-links/
Hope this helps
Absolutely brilliant. Many thanks for your help, friends!
Youโre Welcome ๐
Thanks a ton, Abhishek, was looking for this from a long time! :-DD
Strange, but this did not work for me.
https://timeforabetteryou.com/
Chris
you’re in Extra not Divi. Change the following line:
$(‘.et-social-icons .et-social-icon a’).click(function(e) {
to
$(‘.et-extra-social-icons .et-extra-social-icon a’).click(function(e) {
Hi Chris, if it didn’t work for you, try this plugin: https://wordpress.org/plugins/open-external-links-in-a-new-window/