内容的栏目 * @param int $category 0列表 1频道 2单页 3外链 * @return array */ function category_list($forumlist, $model = 0, $display = 0, $category = 0) { if (empty($forumlist)) return NULL; static $cache = array(); $key = $model . '-' . $display . '-' . $category; if (isset($cache[$key])) return $cache[$key]; if ($display) { foreach ($forumlist as $k => $val) { if (1 == $val['display'] && 1 == $val['type'] && $val['category'] == $category) { $cache[$key][$k] = $val; } } } else { foreach ($forumlist as $k => $val) { if (1 == $val['type'] && $val['category'] == $category) { $cache[$key][$k] = $val; } } } return empty($cache[$key]) ? NULL : $cache[$key]; } /** * @param $forumlist 所有版块列表 不分模型 * @param int $display 0全部CMS栏目 1在首页和频道显示内容的栏目 * @param int $category 0列表 1频道 2单页 3外链 * @return array */ function category_list_show($forumlist, $display = 0, $category = 0) { if (empty($forumlist)) return NULL; static $cache = array(); $key = $display . '-' . $category; if (isset($cache[$key])) return $cache[$key]; if ($display) { foreach ($forumlist as $k => $val) { if (1 == $val['display'] && 1 == $val['type'] && $val['category'] == $category) { $cache[$key][$k] = $val; } } } else { foreach ($forumlist as $k => $val) { if (1 == $val['type'] && $val['category'] == $category) { $cache[$key][$k] = $val; } } } return empty($cache[$key]) ? NULL : $cache[$key]; } /** * @param $forumlist 所有版块列表 * @return mixed BBS栏目数据(仅列表) 尚未开放bbs频道功能 */ function forum_list($forumlist) { if (empty($forumlist)) return array(); static $cache = array(); if (isset($cache['bbs_forum_list'])) return $cache['bbs_forum_list']; $cache['bbs_forum_list'] = array(); foreach ($forumlist as $_fid => $_forum) { if ($_forum['type']) continue; $cache['bbs_forum_list'][$_fid] = $_forum; } return $cache['bbs_forum_list']; } // 导航显示的版块 function nav_list($forumlist) { if (empty($forumlist)) return NULL; static $cache = array(); if (isset($cache['nav_list'])) return $cache['nav_list']; foreach ($forumlist as $fid => $forum) { if (0 == $forum['nav_display']) { unset($forumlist[$fid]); } } return $cache['nav_list'] = $forumlist; } ?>javascript - Resizing JQuery thickbox window dynamically - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Resizing JQuery thickbox window dynamically - Stack Overflow

programmeradmin0浏览0评论

I have a thickbox that pops up when you click on a link. Depending on the user's browser size I want the thickbox to be a constant 500px or so width and the height to change dynamically depending on the height of user's browser. Is this possible?

I have a thickbox that pops up when you click on a link. Depending on the user's browser size I want the thickbox to be a constant 500px or so width and the height to change dynamically depending on the height of user's browser. Is this possible?

Share Improve this question asked Nov 30, 2010 at 23:10 ToddTodd 311 silver badge2 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 4

In my case : (CSS only)

#TB_window {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-height: 100%;
    max-width: 90%;
    margin: 0 !important;
}
#TB_ajaxContent {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
    box-sizing: border-box;
}

another option is to use JQuery to work out the browser size and then resize thickbox to suit. this is not as elegant as the CSS solution but just to plete the answer... here is a method do get it done.

// set the displayWidth/Height to be 90% of the window
var displayWidth = $(window).width() * 0.9;
var displayHeight = $(window).height() * 0.9;
// Animate the thickbox window to the new size (with 50px padding 
$("#TB_window").animate({
    marginLeft: 0 - (displayWidth + 50) / 2,
    marginTop: 0 - (displayHeight + 50) / 2,
    height: displayHeight + 50,
    width: displayWidth + 30
}, {
    duration: 800
});
$("#TB_ajaxContent").animate({
    height: displayHeight,
    width: displayWidth
}, {
    duration: 800
});

You can adjust the css to make the height change dynamically. Something like this should work:

#TB_window {
    top:0;
    height:100%;
    margin-top:0 !important;
    border-top:0;
    border-bottom:0;
}

Tested answer using just CSS:

@media all and (max-width: 640px){
    #TB_window {
        top: 0 !important;
        left: 0 !important;
        margin-top: 0 !important;
        margin-left: 0 !important;
        height: 100%;
        width: 100% !important;
    }
    #TB_iframeContent{
        max-width:100%;
        width:100%;
    }
}
发布评论

评论列表(0)

  1. 暂无评论