Thread: share popup
View Single Post
Old 10-02-2012, 08:06 PM   PM User | #11
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,461
Thanks: 52
Thanked 457 Times in 455 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
you can trigger a click on the link...
Code:
<script type="text/javascript"> 
$(document).ready(function() {
$("a[rel='pop-up']").bind('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; 	
       	}
    });
$("a[rel='pop-up']").trigger('click');	
});

</script>
but all of that is going to be kind of meaningless if the user has pop-ups blocked. why not use a real modal window?
xelawho is offline   Reply With Quote