开发者

Pop Under on Click for RSS Feed - Javascript

I want to set up the site so when users click on RSS feed links (which I display in part of the site), the feed link appears in a pop under. It makes sense on the site. It's something my users want.

What I can't figure out is how to populate the rss links that I'm pulling to get them to open in a pop under.

I've got this:

$(document).ready(function(){
 $("a[href^='http']").attr('target','_blank');
}); 

which does open the link in a new wind开发者_如何学运维ow. I can add another line like this:

     $("a[href^='http']").attr('onClick','openpopup()');

but I'm not sure how to craft some javascript that will 1) grab the href from the anchor; 2) replace it with a javascript(void); 3) use that url in something like this:

function openpopup() {
window.open("url","","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no,width=1250,height=500,left=250,top=175").blur(); window.focus();}

Any ideas?


Not much of a jQuery guy, but this should work

$("a[href^='http']").click(function(event) {
    event.preventDefault(); // prevent the link from opening directly
    // open a pop for the link's url 
    var popup = window.open( this.href , "", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no,width=1250,height=500,left=250,top=175" ); 
    popup.blur();
    window.focus();
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜