HOW TO OPEN MENU LINK LIST OPEN IN NEW TAB / WINDOW -BLOGGER-WORDPRESS ... - MRNIAMSTER

Advertisement

Post Top Ad

HOW TO OPEN MENU LINK LIST OPEN IN NEW TAB / WINDOW -BLOGGER-WORDPRESS ...

Share This






When we add the "Link List" widget or gadget, all  links were open in the same window when clicked which will make your reader leaves your blog/site.


With this simple script, all the links from the "Link List" widget will be open in new tab. Sounds great?!!

Anyway, here's the code:

As usual, from Dashboard > Template > then Edit HTML then,

First,add this line of code above the </head> tag.

 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
Ignore if you have it already.


Then,find </body>  tag and paste the code above it.


<script type='text/javascript'>
 $(function(){
    $("#LinkList1 a").attr("target","_blank");
 });
</script>
Customization:


LinkList1 - Change it depends on the Link List ID.

That's it! Just comment below if it doesn't work.

UPDATE:  If you want a specific link in a "link list" to open in new tab. Use this code instead.
<script type='text/javascript'>
 $(document).ready(function() { 
  $("a[href='LINKS HERE']").attr('target', '_blank');} 
 );
</script>


Source : Click here


Post Bottom Ad