开发者

Is it possible to center a popup window using CodeIgniter's anchor_popup function?

I know how to center a regular popup window with javascript, but I can't get it to work with CodeIgniter's anchor_popup function.

Here is my code

$attributes = array(
    'class'     =>  'blue-button',
    'width'     =>  '800',
    'height'    =>  '600',  
 开发者_如何学Go   'screenx'   =>  '(window.width - 800) / 2',
    'screeny'   =>  '(window.height - 600) / 2'
);

echo anchor_popup('program/start_worksheet/8', 'Start Worksheet', $attributes);


This works for me:

<?php
$attributes = array(
    'class'     =>  'blue-button',
    'width'     =>  '800',
    'height'    =>  '600',
    'screenx'   =>  '\'+((parseInt(screen.width) - 800)/2)+\'',
    'screeny'   =>  '\'+((parseInt(screen.height) - 600)/2)+\'',
);
echo anchor_popup('program/start_worksheet/8', 'Start Worksheet', $attributes);
?>

Edit: Actually as I look at this now ... this seems to be like a little hack for this function in the url helper but as it works it is ok i think

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜