Team:Linkoping Sweden/popup
From 2014.igem.org
(Difference between revisions)
(5 intermediate revisions not shown) | |||
Line 16: | Line 16: | ||
display:none; | display:none; | ||
z-index:9999; | z-index:9999; | ||
- | padding:20px; | + | padding:20px 0px; |
} | } | ||
/* Customize your modal window here, you can add background image too */ | /* Customize your modal window here, you can add background image too */ | ||
Line 34: | Line 34: | ||
//Cancel the link behavior | //Cancel the link behavior | ||
e.preventDefault(); | e.preventDefault(); | ||
+ | e.stopPropagation(); | ||
//Get the A tag | //Get the A tag | ||
var id = $(this).attr('href'); | var id = $(this).attr('href'); | ||
Line 41: | Line 42: | ||
var maskWidth = $(window).width(); | var maskWidth = $(window).width(); | ||
var horizOffset = ($(window).width() - 1100) / -2; | var horizOffset = ($(window).width() - 1100) / -2; | ||
- | var vertOffset = - | + | var vertOffset = -40; |
//Set height and width to mask to fill up the whole screen | //Set height and width to mask to fill up the whole screen | ||
Line 53: | Line 54: | ||
var winH = $(window).height(); | var winH = $(window).height(); | ||
var winW = $(window).width(); | var winW = $(window).width(); | ||
+ | if($(id).height() > winH) { | ||
+ | $(id).css('height', winH); | ||
+ | } | ||
+ | if($(id).width() > winW) { | ||
+ | $(id).css('width', winW); | ||
+ | } | ||
//Set the popup window to center | //Set the popup window to center | ||
$(id).css('top', winH/2-$(id).height()/2); | $(id).css('top', winH/2-$(id).height()/2); | ||
Line 70: | Line 77: | ||
//if mask is clicked | //if mask is clicked | ||
- | $('#mask').click(function () { | + | $('#mask').click(function (e) { |
+ | e.preventDefault(); | ||
+ | e.stopPropagation(); | ||
$(this).hide(); | $(this).hide(); | ||
$('.window').hide(); | $('.window').hide(); |
Latest revision as of 09:27, 16 October 2014