Thread: share popup
View Single Post
Old 10-01-2012, 11:33 PM   PM User | #9
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 454 Times in 452 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
Code:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<a href="#" rel='pop-up'>click me</a>
</div>
<script type="text/javascript"> 
$(document).ready(function() {
$("a[rel='pop-up']").click(function () {
    	if($(this).attr("target")!=="_blank") {
        	var pop_w = '650';
            var pop_h = (typeof $(this).attr("data-height") !== "undefined") ? $(this).attr("data-height") : '350';
            var pop_left = (screen.width/2)-(pop_w/2);
            var pop_top = (screen.height/2)-(pop_h/2);
            var settings = "height="+pop_h+", width="+pop_w+", scrollTo, resizable=0, scrollbars=0, location=0, top="+pop_top+", left="+pop_left;  
            window.open(this.href, 'Popup', settings);  
            return false; 	
       	}
    });
});
</script>

</body>
</html>
xelawho is offline   Reply With Quote
Users who have thanked xelawho for this post:
Chris-2k (10-02-2012)