Created
December 12, 2011 04:22
-
-
Save peterwilsoncc/1464848 to your computer and use it in GitHub Desktop.
"Responsive" lightbox -- requires jQuery & fancybox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>blah</title> | |
</head> | |
<body> | |
<header> ... </header> | |
<section>... </section> | |
<footer> ... </footer> | |
<div id="responsiveChecks"></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).ready(function(){ | |
$(window).trigger('resize'); | |
}).resize(function(){ | |
checkSize(); | |
}); | |
function checkSize() { | |
var $check = $('#responsiveChecks'), | |
screenSize = $check.position().left * -1; | |
if (screenSize == 960) { | |
//setup fancybox | |
$('a.lightbox').fancybox({}); | |
} | |
else { | |
$('a.lightbox').unbind('click.fb'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
allows size checking to be based on what the css reckons. | |
*/ | |
#responsiveChecks { | |
position: absolute; | |
width: 1px; | |
height:1px; | |
top:0; | |
left: -320px; | |
} | |
@media all and (min-width:480px) { | |
#responsiveChecks { | |
left: -480px; | |
} | |
} | |
@media all and (min-width:760px) { | |
#responsiveChecks { | |
left: -760px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment