Pop-up window in Javascript -
i'm using custom tumblr share button on blogger-based website , i'd share screen open in pop-up window. right opens in new tab. can please show me how this? js skills beginner level
thanks in advance!
<div class='tumblr-button'> <script> var strposturl = "<data:post.url/>"; var strposttitle = '<data:post.title/>'; var strnewurl = strposturl.replace("http://",""); var strnewtitle = strposttitle.replace(/"/g, '"'); document.write("<a href='http://www.tumblr.com/share/link?url="+strnewurl+"&name="+strnewtitle+"' target='_new'><img src='http://platform.tumblr.com/v1/share_1.png'/></a>"); </script> </div>
<div class='tumblr-button'> <script> var strposturl = "http://google.com"; var strposttitle = 'google'; var strnewurl = strposturl.replace("http://",""); var strnewtitle = strposttitle.replace(/"/g, '"'); </script> <a href='javascript:void(0);' id='tumblr'><img src='http://platform.tumblr.com/v1/share_1.png'/></a> </div> <script type="text/javascript"> jquery(document).ready(function(){ jquery('#tumblr').click(function(){ var width = 775, height = 500, left = ($(window).width() - width) / 2, top = ($(window).height() - height) / 2, opts = 'status=1' + ',width=' + width + ',height=' + height + ',top=' + top + ',left=' + left; var url = "http://www.tumblr.com/share/link?url="+strnewurl+"&name="+strnewtitle; window.open(url , 'tumblr', opts); }); }); </script>
check demo code on http://jsfiddle.net/gzmxd/
javascript window tumblr blogger pop-up
No comments:
Post a Comment