60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
$(function()
|
|
{
|
|
var w = 1310;
|
|
if(window.innerWidth >= 1360 && window.innerWidth <= 1420)
|
|
{
|
|
w = 1200;
|
|
}
|
|
if(window.innerWidth >= 1280 && window.innerWidth < 1360)
|
|
{
|
|
w = 1130;
|
|
}
|
|
var announce_panel_offset = (window.innerWidth - w) / 2;
|
|
console.log("window", announce_panel_offset, w);
|
|
|
|
if(window.innerWidth > 1279)
|
|
{
|
|
$("#main_menu_announce").css("margin-left", '-'+announce_panel_offset+'px');
|
|
$("#main_menu_announce").css("margin-right", '-'+announce_panel_offset+'px');
|
|
$("#main_menu_announce_content").css("margin-left", announce_panel_offset+'px');
|
|
$("#main_menu_announce_content").css("margin-right", announce_panel_offset+'px');
|
|
}
|
|
else
|
|
{
|
|
$("#main_menu_announce").css("margin-left", '0px');
|
|
$("#main_menu_announce").css("margin-right", '0px');
|
|
$("#main_menu_announce_content").css("margin-left", '0px');
|
|
$("#main_menu_announce_content").css("margin-right", '0px');
|
|
}
|
|
|
|
$(window).on("resize", function()
|
|
{
|
|
var w = 1310;
|
|
if(window.innerWidth >= 1360 && window.innerWidth <= 1420)
|
|
{
|
|
w = 1200;
|
|
}
|
|
if(window.innerWidth >= 1280 && window.innerWidth < 1360)
|
|
{
|
|
w = 1130;
|
|
}
|
|
var announce_panel_offset = (window.innerWidth - w) / 2;
|
|
console.log("window", announce_panel_offset, w);
|
|
|
|
if(window.innerWidth > 1279)
|
|
{
|
|
$("#main_menu_announce").css("margin-left", '-'+announce_panel_offset+'px');
|
|
$("#main_menu_announce").css("margin-right", '-'+announce_panel_offset+'px');
|
|
$("#main_menu_announce_content").css("margin-left", announce_panel_offset+'px');
|
|
$("#main_menu_announce_content").css("margin-right", announce_panel_offset+'px');
|
|
//console.log("window", window.innerWidth);
|
|
}
|
|
else
|
|
{
|
|
$("#main_menu_announce").css("margin-left", '0px');
|
|
$("#main_menu_announce").css("margin-right", '0px');
|
|
$("#main_menu_announce_content").css("margin-left", '0px');
|
|
$("#main_menu_announce_content").css("margin-right", '0px');
|
|
}
|
|
});
|
|
}); |