01 02 03 04 05 06 07 08 09 10 11 12 13 | $( 'A[rel="external"]' ) .click( function () { window.open( $( this ).attr( 'href' ) ); return false ; });</pre> <blockquote class = "wp-embedded-content" data-secret= "viEnHr77Z2" ><a href= "https://css-tricks.com/snippets/jquery/open-external-links-in-new-window/" >Open External Links In New Window</a></blockquote><iframe title= "“Open External Links In New Window” — CSS-Tricks" class = "wp-embedded-content" sandbox= "allow-scripts" security= "restricted" style= "position: absolute; clip: rect(1px, 1px, 1px, 1px);" src= "https://css-tricks.com/snippets/jquery/open-external-links-in-new-window/embed/#?secret=viEnHr77Z2" data-secret= "viEnHr77Z2" width= "600" height= "338" frameborder= "0" marginwidth= "0" marginheight= "0" scrolling= "no" ></iframe> Oznaczenie zewnętrznych linków za pomocą css: <pre>a[target= "_blank" ] { padding-right: 18px; display: inline-block; line-height: 14px; background: url(new_window.png) center right no-repeat; } |
Obrazek:
http://www.tarnaski.eu/blog/wp-content/themes/minyx2Lite/pix/new_window.png
http://www.tarnaski.eu/blog/znowu-lubimy-target_blank/