Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- STYLES.CSS
- /* http://meyerweb.com/eric/tools/css/reset/
- v2.0 | 20110126
- License: none (public domain)
- */
- @import url(http://fonts.googleapis.com/css?family=Roboto+Condensed);
- html, body, div, span, applet, object, iframe,
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
- a, abbr, acronym, address, big, cite, code,
- del, dfn, em, img, ins, kbd, q, s, samp,
- small, strike, strong, sub, sup, tt, var,
- b, u, i, center,
- dl, dt, dd, ol, ul, li,
- fieldset, form, label, legend,
- table, caption, tbody, tfoot, thead, tr, th, td,
- article, aside, canvas, details, embed,
- figure, figcaption, footer, header, hgroup,
- menu, nav, output, ruby, section, summary,
- time, mark, audio, video {
- margin: 0;
- padding: 0;
- border: 0;
- font-size: 100%;
- font: inherit;
- vertical-align: baseline; }
- /* HTML5 display-role reset for older browsers */
- article, aside, details, figcaption, figure,
- footer, header, hgroup, menu, nav, section {
- display: block; }
- body {
- line-height: 1; }
- ol, ul {
- list-style: none; }
- blockquote, q {
- quotes: none; }
- blockquote:before, blockquote:after,
- q:before, q:after {
- content: '';
- content: none; }
- table {
- border-collapse: collapse;
- border-spacing: 0; }
- html,
- body {
- min-height: 100%;
- overflow-x: hidden; }
- body {
- background-color: #f8f7f5;
- background-image: linear-gradient(to top, gray, #f8f7f5 30%);
- color: #333;
- font-family: 'Roboto Condensed', sans-serif;
- text-transform: uppercase;
- letter-spacing: 4px;
- font-size: 12px;
- -webkit-font-smoothing: antialiased;
- text-rendering: optimizeLegibility;
- overflow-y: hidden; }
- a {
- text-decoration: none;
- color: #333; }
- .small {
- font-size: .7em; }
- h1,
- .link {
- position: fixed;
- z-index: 999; }
- .link {
- padding: .8em 1.3em;
- top: 5em; }
- h1 {
- background-color: #fff;
- font-size: 14px;
- letter-spacing: 4px;
- padding: .8em 1.5em;
- left: 4em;
- top: 4em;
- border-bottom: 2px solid #333; }
- #about {
- left: 19em; }
- #contact {
- left: 26em; }
- #diary {
- left: 35em; }
- #footer {
- margin: 4em auto;
- background-color: #fff;
- padding: 0.8em 1em;
- max-width: 11em;
- text-align: center; }
- #backToTop {
- position: static;
- display: block;
- max-width: 9em;
- padding: .3em 1em .8em;
- margin: 17% auto 0;
- background-color: #fff;
- text-align: center;
- line-height: 120%; }
- #backToTop span {
- display: block;
- -webkit-transform: rotate(270deg);
- -ms-transform: rotate(270deg);
- -moz-transform: rotate(270deg);
- -o-transform: rotate(270deg);
- transform: rotate(270deg);
- -webkit-transition: none;
- -ms-transition: none;
- -moz-transition: none;
- -o-transition: none;
- transition: none;
- -webkit-animation-fill-mode: forwards;
- -ms-animation-fill-mode: forwards;
- -moz-animation-fill-mode: forwards;
- -o-animation-fill-mode: forwards;
- animation-fill-mode: forwards; }
- #contentWrapper div {
- position: relative; }
- #contentWrapper div img {
- position: relative;
- opacity: 0;
- transition: opacity .3s ease-in; }
- .popup {
- position: fixed; }
- #aboutWrapper,
- #contactWrapper,
- #diaryWrapper {
- box-sizing: content-box;
- padding: 4em;
- display: none;
- z-index: 1000;
- line-height: 1.5;
- overflow: scroll;
- max-height: 80%;
- max-width: 700px;
- opacity: 0;
- transition: opacity .3s ease-in;
- background-color: white; }
- #aboutWrapper .close,
- #contactWrapper .close,
- #diaryWrapper .close {
- position: absolute;
- top: 10px;
- right: 10px;
- font-size: 2em; }
- #aboutWrapper h2,
- #contactWrapper h2,
- #diaryWrapper h2 {
- padding: 1em 0;
- font-weight: bold; }
- #aboutWrapper img,
- #contactWrapper img,
- #diaryWrapper img {
- display: block;
- margin: auto; }
- #aboutWrapper p,
- #contactWrapper p,
- #diaryWrapper p {
- padding: 1em 0; }
- #aboutWrapper .small,
- #contactWrapper .small,
- #diaryWrapper .small {
- display: block;
- text-align: right;
- padding: 0.5em 0; }
- #aboutWrapper {
- text-transform: none; }
- .shown {
- display: inline-block !important;
- opacity: 1 !important; }
- .mobile img {
- width: 100%; }
- .mobile #img1,
- .mobile #img2 {
- margin-top: 0 !important; }
- .mobile #img1 img,
- .mobile #img2 img {
- margin-left: 0 !important; }
- @media screen and (max-width: 1080px) {
- .link {
- top: 0;
- left: 2em !important;
- display: block;
- padding: .8em 1.5em; }
- h1 {
- top: 2em;
- left: 2em; }
- #about {
- top: 8em; }
- #contact {
- top: 12em; }
- #diary {
- top: 16em; }
- .popup,
- #aboutWrapper,
- #contactWrapper,
- #diaryWrapper {
- box-sizing: border-box;
- padding: 2em 5%;
- top: 0;
- width: 100%;
- max-width: 100%;
- min-height: 100%;
- max-height: none; }
- .popup img,
- #aboutWrapper img,
- #contactWrapper img,
- #diaryWrapper img {
- width: 50%; }
- .popup .close,
- #aboutWrapper .close,
- #contactWrapper .close,
- #diaryWrapper .close {
- top: 5%;
- right: 5%;
- font-size: 4em;
- line-height: 100%; } }
- jQuery Unveil
- /**
- * jQuery Unveil
- * A very lightweight jQuery plugin to lazy load images
- * http://luis-almeida.github.com/unveil
- *
- * Licensed under the MIT license.
- * Copyright 2013 LuÃs Almeida
- * https://github.com/luis-almeida
- */
- ;(function($) {
- $.fn.unveil = function(threshold, callback) {
- var $w = $(window),
- th = threshold || 0,
- retina = window.devicePixelRatio > 1,
- attrib = retina? "data-src-retina" : "data-src",
- images = this,
- loaded;
- this.one("unveil", function() {
- var source = this.getAttribute(attrib);
- source = source || this.getAttribute("data-src");
- if (source) {
- this.setAttribute("src", source);
- if (typeof callback === "function") callback.call(this);
- }
- });
- function unveil() {
- var inview = images.filter(function() {
- var $e = $(this);
- if ($e.is(":hidden")) return;
- var wt = $w.scrollTop(),
- wb = wt + $w.height(),
- et = $e.offset().top,
- eb = et + $e.height();
- return eb >= wt - th && et <= wb + th;
- });
- loaded = inview.trigger("unveil");
- images = images.not(loaded);
- }
- $w.on("scroll.unveil resize.unveil lookup.unveil", unveil);
- unveil();
- return this;
- };
- })(window.jQuery || window.Zepto);
- SCRIPT.JS
- $(document).ready(function(){
- var windowWidth = $(window).width(),
- i = 3,
- isMobile = window.isMobile();
- if (!isMobile) {
- // Randomize image position and scroll speed on desktops
- var s = skrollr.init();
- $("#contentWrapper").on('DOMNodeInserted', 'div', function(){
- $(this).find("img").load(function(){
- var w = this.width,
- h = this.height,
- randomIndex = getRandomInt(0, 9),
- // Each image's scroll top and scroll bottom positions will be adjusted by semi-randomly choosen delta
- // The bigger the delta, the faster the scroll
- delta = [1,1,1,8,8,8,25,25,25,25][randomIndex]*50;
- // Set scroll attributes
- $(this).attr({
- "data-bottom-top": "top: " + delta + "px;",
- "data-top-bottom": "top: " + (0-delta) + "px;",
- "data-anchor-target": "#img"+i
- });
- s.refresh($("#contentWrapper #img"+i+" img"));
- // Position the image horizontally randomly on the screen
- $(this).css({
- "margin-left": getRandomInt(-w/4, windowWidth-w*0.75),
- "opacity": 1,
- "transition": "none"
- });
- // Get the next photo URL and check if it exists on server.
- var nextImageURL = "img/photos/" + (++i) + ".jpg";
- $.ajax({
- url: nextImageURL,
- type:'HEAD',
- success: function() {
- // If photo exists, attach it to the page.
- $("#contentWrapper").append("<div id=\"img"+i+"\"><img src=\""+nextImageURL+"\" /></div>");
- // Position the image vertically randomly on the screen
- // Depends on the previous image height (should not cover too much), that's why applied here.
- $("#img"+i).css("margin-top", getRandomInt(-3*h/5, -h/5));
- }
- });
- });
- });
- // Attach the first dynamic image and start rolling.
- // First and second photos' positions are fixed, so we start attaching dynamically from #3.
- $("#contentWrapper").append("<div id=\"img3\"><img src=\"img/photos/3.jpg\" /></div>");
- } else {
- // On mobile, attach all dynamic DOM elements without waiting for images to load. Then apply lazy load (unveil) to images.
- $("body").addClass("mobile");
- $("#contentWrapper").on('DOMNodeInserted', 'div', function(){
- var nextImageURL = "img/photos/" + (++i) + ".jpg";
- $.ajax({
- url: nextImageURL,
- type:'HEAD',
- success: function() {
- $("#contentWrapper").append("<div id=\"img"+i+"\"><img src=\"img/loading.gif\" data-src=\""+nextImageURL+"\" /></div>");
- },
- error: function() {
- $("img").unveil(200, function() {
- $(this).load(function() {
- this.style.opacity = 1;
- });
- });
- }
- });
- });
- $("#contentWrapper").append("<div id=\"img3\"><img src=\"img/loading.gif\" data-src=\"img/photos/3.jpg\" /></div>");
- }
- $('#backToTop').click(function(e) {
- e.preventDefault();
- $('html, body').animate({scrollTop: 0}, 300);
- return false;
- });
- $('#about, #contact, #diary').click(function(e) {
- e.preventDefault();
- var popupID = '#' + this.id + 'Wrapper';
- $('.popup:not('+popupID+')').removeClass('shown');
- $(popupID).toggleClass("shown");
- if (!isMobile) {
- $(popupID).center();
- }
- return false;
- });
- $(".close").click(function(e) {
- e.preventDefault();
- $(".popup").removeClass('shown');
- return false;
- });
- $(document).keyup(function(e) {
- if (e.which === 27) {
- $(".popup").removeClass('shown');
- }
- });
- $('body').click(function(e) {
- if ($(e.target).closest('.popup').length === 0){
- $(".popup").removeClass("shown");
- }
- });
- });
- window.isMobile = function() {
- var check = false;
- (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);
- return check;
- }
- function getRandomInt(min, max) {
- return Math.floor(Math.random() * (max - min + 1)) + min;
- }
- $.fn.center = function() {
- this.css("top", ($(window).height()/2 - $(this).outerHeight()/2) + "px");
- this.css("left", ($(window).width()/2 - $(this).outerWidth()/2) + "px");
- return this;
- };
- SCRIPT
- <!DOCTYPE html>
- <head>
- <title>Posternaks Film Photography</title>
- <meta content='posternaks, film, photography, photos, portfolio, photographer, sisters, twins' name='keywords'>
- <meta content='Posternaks photography portfolio' name='description'>
- <link href='img/icon.png' rel='shortcut icon'>
- <link href='css/styles.css' rel='stylesheet' type='text/css'>
- <script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js' type='text/javascript'></script>
- <script src='https://cdnjs.cloudflare.com/ajax/libs/skrollr/0.6.29/skrollr.min.js' type='text/javascript'></script>
- <script src='js/jquery.unveil.js' type='text/javascript'></script>
- <script src='js/scripts.js' type='text/javascript'></script>
- </head>
- <body>
- <h1>
- <a href='/'>Posternaks</a>
- </h1>
- <a class='link' href='#' id='about'>About</a>
- <a class='link' href='#' id='contact'>Contact</a>
- <a class='link' href='#' id='diary'>Diary</a>
- <div id='contentWrapper'>
- <div id='img1'>
- <img data-anchor-target='#img2' data-bottom-top='top: 420px;' data-top-bottom='top:-20px;' src='img/photos/2.jpg' style='margin-left: 45%; opacity:1;'>
- </div>
- <div id='img2' style='margin-top: -30%;'>
- <img data-anchor-target='#img1' data-bottom-top='top: 20px;' data-top-bottom='top:-20px;' src='img/photos/1.jpg' style='margin-left: 10%; opacity:1;'>
- </div>
- </div>
- <div id='footer'>
- © Posternaks
- </div>
- <a class='link' href='/' id='backToTop'>
- <span>〉</span>
- <br>
- Back to top
- </a>
- <div class='popup' id='aboutWrapper'>
- <a class='close' href='#'>X</a>
- <p>
- Zhenya and Tanya Posternak, twin-sisters from Kiev, Ukraine.
- <br>
- Currently based in NYC.
- </p>
- </div>
- <div class='popup' id='contactWrapper'>
- <a class='close' href='#'>X</a>
- <h2>Say hello at:</h2>
- <a href='mailto:tposternak@gmail.com' target='_blank'>tposternak@gmail.com</a>
- <br>
- <a href='mailto:zposternak@gmail.com' target='_blank'>zposternak@gmail.com</a>
- </div>
- <div class='popup' id='diaryWrapper'>
- <a class='close' href='#'>X</a>
- <h2>Follow us:</h2>
- <a href='https://instagram.com/zposternak/' target='_blank'>instagram/zposternak</a>
- <br>
- <a href='https://instagram.com/tanyaposternak/' target='_blank'>instagram/tanyaposternak</a>
- </div>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement