Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* JS DOCUMENTATION:
- * FOLIO Ner2 *
- */
- /*********************************************
- * ON READY
- *********************************************/
- var donde = null;
- jQuery(document).ready(function($){
- mode = 0;
- var thumbOpacity = $('body').attr('class').split('thumb-opacity-')[1];
- if($('body').hasClass('layout-2')){
- $("a[data-gal^='prettyPhoto']").prettyPhoto({ default_width: 650, default_height: 425 });
- }
- /**********************************
- ADJUST DINAMIC HEIGHT FOR HEADER
- ***********************************/
- var topSection = $("#top-title-bar").height();
- $("#thumb-wrapper").css("margin-top", topSection);
- if($(window).width() < 480){
- $("#top-title-bar-sdevice").height() == topSection/2;
- $("#thumb-wrapper").css("margin-top", topSection/2);
- }
- if ( $('body.fixed-nav').length){
- var topSection = 0;
- }
- /*Displace the navigation bar on iPhone*/
- (function($) {
- $(document).ready(function() {
- setTimeout(function () {
- window.scrollTo(0, 0);
- }, 100);
- });
- })(jQuery);
- $(window).bind('orientationchange resize', function(event){
- var orient = window.orientation;
- if(orient == 0) { //0 = portrait, -90 or 90 = landscape
- window.scrollTo(0, 0);
- } else {
- window.scrollTo(0, 0);
- }
- });
- /***************************
- MULTIDISPLAY SMART COLLUMS
- ***************************/
- function smartColumns(colSize) {
- //Create a function that calculates the smart columns | First we need to check if it is a mobile device
- if($(window).width() < 680){
- //Reset column size to a 100% once view port has been adjusted
- $("ul#thumbs").css({ 'width' : "100%"});
- var colWrap = $("ul#thumbs").width(); //Get the width of row
- var colNum = Math.floor(colWrap / 85); //Find how many columns of 200px can fit per row / then roundit down to a whole number
- var colFixed = Math.floor(colWrap / colNum); //Get the width of the row and divide it by the number of columns it can fit / then roundit down to a whole number. This value will be the exact width of the re-adjusted column
- $("ul#thumbs").css({ 'width' : colWrap}); //Set exact width of row in pixels instead of using % - Prevents cross-browser bugs that appear in certain view port resolutions.
- $("ul#thumbs li").css({ 'width' : colFixed}); //Set exact width of the re-adjusted column
- }else{ //If not a mobile device
- //Reset column size to a 100% once view port has been adjusted
- $("ul#thumbs").css({ 'width' : "100%"});
- var colWrap = $("ul#thumbs").width(); //Get the width of row
- var colNum = Math.floor(colWrap / colSize); //Find how many columns of colSize value set in option panel can fit per row / then roundit down to a whole number
- var colFixed = Math.floor(colWrap / colNum); //Get the width of the row and divide it by the number of columns it can fit / then roundit down to a whole number. This value will be the exact width of the re-adjusted column
- $("ul#thumbs").css({ 'width' : colWrap}); //Set exact width of row in pixels instead of using % - Prevents cross-browser bugs that appear in certain view port resolutions.
- $("ul#thumbs li").css({ 'width' : colFixed}); //Set exact width of the re-adjusted column
- }
- }
- smartColumns($('body').attr('class').split('col-size-')[1].split(' ')[0]);//Run the function when page loads
- /*******************
- // SLIDE NAV
- *******************/
- var navigationWidth = $("#main-nav").width();
- if ( $('body.fixed-nav').length ){
- $("#wrapper").css('margin-left', navigationWidth);
- $('#tab-nav').css('display', 'none');
- $("#top-title-bar, #top-title-bar-sdevice").css('display', 'none').css('height', 0+'px');
- $("#thumb-wrapper").css('margin-top', 0+'px');
- smartColumns($('body').attr('class').split('col-size-')[1].split(' ')[0]);//Run the function when page loads
- }else{
- if(navigator.userAgent.match(/like Mac OS X/i)
- ){
- function checkTopNavMobile() {
- if ($(".top-nav").length > 0){
- $(".tab-nav").remove();
- }
- else {
- barra = $('nav'); // nav
- trabajos = $('#wrapper'); // contents
- loquedura = {queue:true, duration:1250, easing: 'easeInOutExpo'}; // .animate() style
- // slideNav animations
- function para(){ barra.stop(); trabajos.stop(); };
- // return pixels number to move
- function mide(){ return ($('nav').width()-10)+'px'; };
- function slideNav(e){
- para();
- // moves nav
- barra.animate({ left: (e) ? '-'+mide() : 0 }, loquedura);
- // moves contents
- trabajos.animate({ left: (e) ? 0 : mide() }, loquedura);
- };
- $('nav').touchwipe({
- wipeLeft: function(){slideNav(1); },
- wipeRight: function(){slideNav();}
- })
- $("#tap-close").click(function(){ slideNav(1); });
- var initBar = setTimeout(slideNav(1), 500);
- }
- }
- checkTopNavMobile();
- }else{
- function checkTopNav() {
- //First we need to detect if top navigation mode is active. If it is, remove lateral navigation behaviors for hover states
- if ($(".top-nav").length > 0){
- $(".tab-nav").remove();
- }
- else {
- barra = $('nav'); // nav
- trabajos = $('#wrapper'); // contents
- loquedura = {queue:true, duration:1250, easing: 'easeInOutExpo'}; // .animate() style
- // slideNav animations
- function para(){ barra.stop(); trabajos.stop(); };
- // return pixels number to move
- function mide(){ return ($('nav').width()-10)+'px'; };
- function slideNav(e){
- para();
- // moves nav
- barra.animate({ left: (e) ? '-'+mide() : 0 }, loquedura);
- // moves contents
- trabajos.animate({ left: (e) ? 0 : mide() }, loquedura);
- };
- barra.mouseenter(function(){ slideNav();});
- barra.mouseleave(function(){ slideNav(1); });
- $("#tap-close").click(function(){ slideNav(1); });
- var initBar = setTimeout('barra.mouseleave()',1000);
- }
- }
- checkTopNav();
- }
- }
- //iOS control bug zoom
- var mobile_timer = false;
- if(navigator.userAgent.match(/iPhone/i)) {
- $('#viewport').attr('content','width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0');
- $(window).bind('gesturestart',function () {
- clearTimeout(mobile_timer);
- $('#viewport').attr('content','width=device-width,minimum-scale=1.0,maximum-scale=10.0');
- }).bind('touchend',function () {
- clearTimeout(mobile_timer);
- mobile_timer = setTimeout(function () {
- $('#viewport').attr('content','width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0');
- },1000);
- });
- }
- /*******************
- // PRELOADER
- *******************/
- spinnerWrapper = $('<div id="spinnerWrapper"></div>');
- $("body").append(spinnerWrapper);
- function setPreloader(){
- var wrapper = $("body");
- var theItem = $("#spinnerWrapper");
- var contWidth = $(wrapper).width();
- var contMiddleW = contWidth/2;
- var locMiddleW = theItem.width()/2;
- var theMiddleW = contMiddleW-(locMiddleW+9);
- var contHeight = $(window).height();
- var contMiddleH = contHeight/2;
- var locMiddleH = theItem.height()/2;
- var theMiddleH = contMiddleH-locMiddleH;
- $("#spinnerWrapper").css("left", theMiddleW).css("top", theMiddleH);
- }
- setPreloader();
- var opts = {
- lines: 13, // The number of lines to draw
- length: 6, // The length of each line
- width: 4, // The line thickness
- radius: 10, // The radius of the inner circle
- rotate: 0, // The rotation offset
- color: '#000', // #rgb or #rrggbb
- speed: 1.7, // Rounds per second
- trail: 35, // Afterglow percentage
- shadow: false, // Whether to render a shadow
- hwaccel: false, // Whether to use hardware acceleration
- className: 'spinner', // The CSS class to assign to the spinner
- zIndex: 2e9, // The z-index (defaults to 2000000000)
- top: 'auto', // Top position relative to parent in px
- left: 'auto' // Left position relative to parent in px
- };
- var div = document.getElementById('spinnerWrapper');
- var spinner = new Spinner(opts).spin(div);
- spinner.stop();div.parentNode.removeChild(div);
- function addPreloader(){
- document.body.appendChild(div);
- spinner.spin(div);
- setPreloader();
- }
- function removePreloader(){
- spinner.stop();
- div.parentNode.removeChild(div);
- }
- //appending the loader to the mouse
- //var el = $(new Spinner(opts).spin().el).css('position', 'absolute').appendTo('body');
- //$(document).mousemove(function(e) {
- // el.css('top', e.clientY).css('left', e.clientX);
- //});
- /******************************************
- // HISTORY | URL CONTROL
- *******************************************/
- var controlPath = "";
- // Prepare our Variables
- var
- History = window.History,
- State = History.getState(),
- rootPath = History.getState().url,
- $mainContent = $("#work-detail-wrapper"),
- $pageWrap = $("#thumb-wrapper"),
- $el,
- scrollOptions = {
- duration: 800,
- easing:'swing'
- };
- if(rootPath != rootUrl){
- $mainContent.slideDown(750, function() {
- var viewportHeight = $(window).height();
- $mainContent.height(viewportHeight);
- $('html,body, #wrapper').animate({scrollTop: $("#work-detail-wrapper").offset().top-topSection}, "slow");
- slideWorks();
- loadWorkHistory();
- addPreloader();
- hideHome();
- });
- }else{
- closeSlideWork();
- showHome();
- }
- $("#works a").click(function(){
- //Check if lightbox mode is enabled, if it is
- //galleries behaviors are disabled
- if($('body').hasClass('layout-1')){
- prevPath = History.getState();
- checkPath = History.getState().url;
- valURL = $(this).attr("href");
- donde = 1;
- mode = 1;
- var path = $(this).attr('href');
- var title = $(this).attr('title');
- History.pushState({state:1},title,path);
- $mainContent.slideDown(750, function() {
- var viewportHeight = $(window).height();
- $mainContent.height(viewportHeight);
- $('html,body, #wrapper').animate({scrollTop: $("#work-detail-wrapper").offset().top-topSection}, "slow");
- slideWorks();
- });
- }
- return false;
- });
- $("#sections a:not(#filters-launcher)").click(function() {
- var checkPath = History.getState().url;
- var valURL = $(this).attr("href");
- donde = 1;
- mode = 1;
- var path = $(this).attr('href');
- var title = $(this).text();
- History.pushState({state:1},title,path);
- $mainContent.slideDown(500, function(){
- var viewportHeight = $(window).height();
- $mainContent.height(viewportHeight);
- $('html,body, #wrapper').animate({scrollTop: $("#work-detail-wrapper").offset().top-topSection}, "slow");
- slideWorks();
- });
- /*
- if ( $.browser.msie ) {
- if(parseInt($.browser.version, 10) <=7){
- window.location.reload();
- } ;
- }
- */
- return false;
- });
- // Hook into State Changes
- History.Adapter.bind(window,'statechange',function() { // Note: Using statechange instead of popstate
- State = History.getState(); // Note: Using History.getState() instead of event.state
- addPreloader();
- if(donde==1){
- loadWorkHistory();
- }
- var tempPath = History.getState().url;
- //If it is the start, close with works grid
- if(tempPath == rootUrl){
- closeStartHistory();
- }
- });
- function scrollableArea(){
- if(!navigator.userAgent.match(/iPhone/i) ||
- !navigator.userAgent.match(/iPod/i)
- ){
- $(window).load(function(){
- $(function()
- {
- $('.scrollable').jScrollPane();
- });
- })
- $(window).resize(function(){
- $('.scrollable').jScrollPane();
- });
- $(function()
- {
- $('.scrollable').jScrollPane();
- });
- $('.scrollable').hover(function(){
- $(".jspVerticalBar").fadeIn("fast")
- }, function(){
- $(".jspVerticalBar").fadeOut("fast")
- })
- }
- }
- function loadWorkHistory(){
- $mainContent.load(History.getState().url+' .item-wrapper', function(response, status, xhr) {
- donde = 1;
- function isWork(){
- if(response.indexOf('<div class="info-work">')==-1){ return false; } else { return true; }
- }
- if(status == "error") {
- alert("Error loading work");
- removePreloader();
- }
- removePreloader();
- // slides on
- if(isWork()==true){
- $('#prev').click(function(){
- activeSlides();
- });
- $('#next').click(function(){
- activeSlides(1);
- });
- }
- checkContentInfo();
- $mainContent.slideDown(300, function() {
- var viewportHeight = $(window).height();
- $mainContent.height(viewportHeight);
- });
- $('html,body').animate({scrollTop: $("#work-detail-wrapper").offset().top-topSection},'slow');
- slideWorks();
- if(isWork()==true){
- centerWork();
- if($('body').hasClass('gal-v2')){centerGallery();}
- }
- closeSlideWork();
- fadeSection();
- if(isWork()==true){
- $('#slideshow').fullDivGal();
- scrollableArea();
- checkContentInfo()
- } else {
- if($(response).find('.section').attr('id')=='about'){
- scrollableArea();
- checkContentInfo()
- }
- if($(response).find('.tweet')){ runTwitter(); }
- if($(response).find('.section').attr('id')=='mydribbble'){
- $("#slider").carouFredSel({
- width: "variable",
- height: "auto",
- items: {
- visible: 3,
- width: "variable",
- height: "variable"
- },
- scroll: {
- mousewheel: true,
- items: 3,
- pauseOnHover: true
- },
- prev: {
- button: ".btn-prev",
- key: "left"
- },
- next: {
- button: ".btn-next",
- key: "right"
- }
- });
- }
- if($(response).find('.section').attr('id')=='contact'){
- $("a[data-gal^='prettyPhoto']").prettyPhoto();
- $('form#ajax_form .submit').click(function(){
- $('#ajax_form .error').hide(); //if error visibile, hide on new click
- var name = $('input#name').val();
- if (name == "" || name == " " || name == "Name") {
- $('input#name').focus().before('<div class="error">Hey, what´s your name...?</div>');
- return false;
- }
- var email_test = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;
- var email = $('input#email').val();
- if (email == "" || email == " ") {
- $('input#email').focus().before('<div class="error">Psssst. You missed one...</div>');
- return false;
- } else if (!email_test.test(email)) {
- $('input#email').select().before('<div class="error">I think your mail is wrong</div>');
- return false;
- }
- var message = $('#message').val();
- if (message == "" || message == " " || message == "Message") {
- $('#message').focus().fadeIn('slow').before('<div class="error">Remember your message!</div>');
- return false;
- }
- $.post(rootUrl+'/wp-admin/admin-ajax.php', { action:"two2_send_contact_form", email:email, name:name, message:message }, function(data){
- $('form#ajax_form').slideUp('fast').before('<div id="success"></div>');
- $('#success').html(data).slideDown(9000);
- });
- return false;
- }); //end click function
- var current_data = new Array();
- $('.clear').each(function(i){
- $(this).removeClass('clear').addClass('clear'+i);
- current_data.push($(this).val());
- $(this).focus(function(){
- if($(this).val() == current_data[i]) {
- $(this).val('');
- }
- });
- $(this).blur(function(){
- var stored_data = current_data[i];
- if($(this).val()==''){
- $(this).val(stored_data);
- }
- })
- });
- }
- }
- });
- }
- /**************************************************
- FADE SECTIONS
- ********************************************************/
- function fadeSection(){
- setTimeout("$('.item-wrapper').animate({opacity: 1},750)", 750);
- setTimeout("$('#divThumbs').animate({opacity: 1},750)", 750);
- }
- function fadeOnCloseSection(){
- $('.item-wrapper').fadeOut("fast");
- $('#divThumbs').fadeOut("fast");
- }
- /**************************************************
- SLIDE WORK WRAPPER
- ********************************************************/
- var navigationWidth = $("#main-nav").width();
- var workWrapper = $('#work-detail-wrapper');
- function viewportHeight(){
- return $(window).height();
- };
- function viewportWidth(){
- if ( $('body.fixed-nav').length ){
- return $(window).width()-navigationWidth;
- }else{
- return $(window).width();
- }
- };
- function slideWorks() {
- if($('body').hasClass('gal-v1')){
- if( navigator.userAgent.match(/Android/i) ||
- navigator.userAgent.match(/webOS/i) ||
- navigator.userAgent.match(/iPhone/i) ||
- navigator.userAgent.match(/iPod/i) ||
- navigator.userAgent.match(/WP7/i) ||
- navigator.userAgent.match(/BlackBerry/)
- ){
- workWrapper.height(viewportHeight()-(topSection-80));
- }
- else{
- workWrapper.height(viewportHeight()-topSection);
- }
- workWrapper.width(viewportWidth());
- }
- else{
- workWrapper.height(viewportHeight()-topSection);
- workWrapper.width(viewportWidth());
- }
- if($('body').hasClass('gal-v2')){
- if( navigator.userAgent.match(/Android/i) ||
- navigator.userAgent.match(/webOS/i) ||
- navigator.userAgent.match(/iPhone/i) ||
- navigator.userAgent.match(/iPod/i) ||
- navigator.userAgent.match(/WP7/i) ||
- navigator.userAgent.match(/BlackBerry/)
- ){
- workWrapper.height(viewportHeight()-(topSection-80));
- }
- else{
- workWrapper.height(viewportHeight()-topSection);
- }
- workWrapper.width(viewportWidth());
- }
- else{
- workWrapper.height(viewportHeight()-topSection);
- workWrapper.width(viewportWidth());
- }
- }
- slideWorks();//Run the function when page loads
- function showHome(){
- $('.hidehome').show('slow');
- }
- function hideHome(){
- $('.hidehome').hide('slow');
- }
- function closeSlideWork(){
- $('#closebt a, #closebt-section a, #top-title-bar figure').click(function () {
- fadeOnCloseSection();
- if(donde==1){
- var checkVideos = $(".wrapper-embed-video").length;
- if(checkVideos > 0){
- var divGal = $('#work-detail-wrapper');
- var videos = divGal.find('iframe');
- var nvideos = videos.length;
- var videoshtml5 = divGal.find('video'); //get html5 videos
- var nvideoshtml5 = videoshtml5.length;
- for ( n = 0 ; n < nvideos ; n++ ){
- var source = videos.eq(n).attr("src");
- videos.eq(n).attr("src","");
- videos.eq(n).attr("src",source);
- };
- function pausePlayer() {
- for(var i = 0; i < nvideoshtml5; i++){
- videoshtml5[i].pause();
- //In order to don´t add youtube&vimeo APIs (overload global js code)
- //this method let you stop all videos when
- //close btn is clicked. A 2000ms delay is needed
- //to reload the src, close and don´t lose sizes
- }
- }
- pausePlayer();
- $("#work-detail-wrapper").slideUp();
- $('html,body, #wrapper').animate({scrollTop: 0}, 500);
- donde = null;
- mode = 0;
- History.replaceState({state:-1},rootTitle,rootUrl);
- return false;
- } else{
- $("#work-detail-wrapper").slideUp();
- $('html,body, #wrapper').animate({scrollTop: 0}, 500);
- donde = null;
- mode = 0;
- History.replaceState({state:-1},rootTitle,rootUrl);
- return false;
- }
- }
- });
- };
- function closeStartHistory(){
- $("#work-detail-wrapper").slideUp();
- $('html,body, #wrapper').animate({scrollTop: 0}, 500);
- donde = null;
- mode = 0;
- History.pushState({state:0},rootTitle,rootUrl);
- removePreloader();
- return false;
- }
- /*************************************************
- * FIX DEEPS FOR YOUTUBE VIDEOS
- ************************************************/
- function fixVideoDeep() {
- $(".video-container iframe").each(function(){
- var ifr_source = $(this).attr('src');
- var wmode = "wmode=transparent";
- if(ifr_source.indexOf('?') != -1){ $(this).attr('src',ifr_source+'?'+wmode);}
- else $(this).attr('src',ifr_source+'?'+wmode);
- });
- }
- /*************************************************
- * CENTERWORK
- ************************************************/
- function centerWork() {
- function wrapper (){
- return $("#work-detail-wrapper");
- }
- var itemW = $(".item-wrapper");
- var theItem = $('.item-wrapper .item');
- //here you can control the galv1 height info
- if($('body').hasClass('gal-v1')){
- theItem.css('height', itemW.height() - 230 +'px');
- }
- else{
- theItem.css('height', itemW.height());
- }
- //Size for the info in mobile devices
- if($(window).width() < 480){
- if($('body').hasClass('gal-v1')){
- theItem.css('height', itemW.height() - 10 +'px');
- }
- }
- };
- if($('body').hasClass('gal-v2')){
- function centerGallery() {
- var wrapper = $("#work-detail-wrapper");
- var theItem = $("#slideshow");
- var contHeight = $(wrapper).height();
- var contMiddle = contHeight/2;
- var locMiddle = theItem.height()/2;
- var theMiddle = contMiddle-locMiddle;
- var wh = $("#work-detail-wrapper").height();
- var ih = $('#slideshow').height();
- if (wh > ih) {
- $('#slideshow').css('margin-top', theMiddle-20 + 'px');
- } else {
- $('#slideshow').css('margin-top',0);
- }
- }
- }
- /*************************************************
- * SET MODE
- ************************************************/
- function setMode() {
- if ($('.item').height() > 0){
- mode = 1;
- }
- else{
- mode = 0;
- }
- }
- /**************************************************
- * REMOVING SCROLLABLE AREA IF EMPTY or iOS DEVICE
- **************************************************/
- function checkContentInfo(){
- if( navigator.userAgent.match(/Android/i) ||
- navigator.userAgent.match(/webOS/i) ||
- navigator.userAgent.match(/iPhone/i) ||
- navigator.userAgent.match(/iPod/i) ||
- navigator.userAgent.match(/iPad/i) ||
- navigator.userAgent.match(/WP7/i) ||
- navigator.userAgent.match(/BlackBerry/)
- ){
- //In order to get a smoother scroll in mobile and touch devices
- //we remove the scrollable feature and we use all the native
- //behaviors for scrolling for each device
- //Scroll area for info work in gal-v1
- $('#scrollArea').removeClass('scrollable');
- //Scroll area for info work in about page
- $('#about>div').removeClass('scrollable');
- //Scroll area for info work in info gal-v2
- $('#info').removeClass('scrollable');
- }
- }
- /************
- ON LOAD
- *************/
- $(window).load(function(){
- (function(){
- $('.thumb').fadeTo(250, thumbOpacity);
- });
- setTimeout((function(){
- slideWorks();
- centerWork();
- if($('body').hasClass('gal-v2')){centerGallery();}
- setMode();
- }), 750);
- });
- /***************************************
- ON RESIZE ADJUST IMAGES
- *********************************************/
- $(window).resize(function(){
- centerTopNavControls();
- slideWorks(); //Esential for calculate sizes in iPad landscape/portrait modes.
- centerWork();
- if($('body').hasClass('gal-v2')){centerGallery();}
- smartColumns($('body').attr('class').split('col-size-')[1].split(' ')[0]);
- //slideNav(1); //Run the function when page loads
- });
- function centerOnOrientationChange(){
- centerWork();
- if($('body').hasClass('gal-v2')){centerGallery();}
- if ($('body.fixed-nav').length == false){
- checkTopNavMobile();
- }
- }
- //check for the orientation event and bind accordingly
- if (window.DeviceOrientationEvent) {
- window.addEventListener('orientationchange', centerOnOrientationChange, false);
- } ;
- /**********************************************
- //NAVIGATION
- ************************************************/
- $('#filters-launcher').click(function(){
- $('#filters').fadeIn(375);
- $('#sections').fadeOut(100);
- function altoScroll(){
- return $('#work-detail-wrapper').height();
- };
- $('html,body,#wrapper').animate({scrollTop: (donde) ? altoScroll() : 0}, 500);
- return false;
- });
- var cat = "none";
- if(cat == "none" )
- $(".thumb").fadeTo(100, thumbOpacity);
- /*******************************************
- //FILTERS
- ********************************************/
- $("#filter-menu a").click(function(e) {
- cat = $(this).attr("class");
- $("#works .thumb").not("."+cat).fadeTo(100, 0.1);
- $("#works .thumb").filter("."+cat).fadeTo(100, 1);
- $("#filter-menu a").parent().removeClass("active");
- $(this).parent().addClass("active");
- function altoScroll(){
- if ($(".top-nav").length > 0){
- var navHeight = $("#main-nav").height();
- var altoTopNav = $('#work-detail-wrapper').height()+(navHeight-topSection); //-40 is the margin top for wrapper. This compensate this margin.
- return altoTopNav;
- }
- else{
- return $('#work-detail-wrapper').height();
- }
- };
- $('html,body,#wrapper').animate({scrollTop: (donde) ? altoScroll() : 0}, 500);
- e.preventDefault();
- e.stopPropagation();
- });
- $("#filter-menu a.none").click(function() {
- $("#works .thumb").animate({ opacity: thumbOpacity },{queue:true, duration:250, easing: 'easeInOutExpo'});
- });
- $('.close-sub').click(function(){
- $('#filters').fadeOut(500);
- $('#sections').fadeIn(500);
- return false;
- });
- /*******************************************
- // TOP NAVIGATION CONTROLS
- ********************************************/
- function centerTopNavControls(){
- var winWidth = $(window).width();
- var sizeButton = $("#slide-controls").width()/2;
- var posMiddle = winWidth/2-(sizeButton+5);
- $("#slide-controls").css("margin-left", posMiddle);
- }
- centerTopNavControls();
- // Check if user is in top navigation mode. If he is, show the smart controls
- if ($(".top-nav").length > 0){
- $("#slide-controls")
- .css("display", "block")
- .fadeOut(10)
- .delay(1000)
- .fadeIn(500);
- }
- //Checkpoints to change controls when user scrolls. Smart control for top navigation mode
- function getPixels(){
- var pos = $(window).scrollTop(); //position of the scrollbar
- var navigationHeight = $("#main-nav").height();
- var trueHeigh = navigationHeight-(topSection+1);
- //$('#pixels').html(pos);
- if ($(".open-nav").length > 0){
- if(pos > trueHeigh){
- $(".scroll-to-menu").fadeIn(500);
- }
- else{
- $(".scroll-to-menu").fadeOut(500)
- }
- }
- else{
- return false;
- }
- };
- $(window).bind('scroll', function(){ //when the user is scrolling...
- getPixels(); //check if nav is open and controls the scroll in order to change the buttons
- });
- $(".launch-nav").click(function(){
- $("nav#main-nav").slideToggle("slow");
- $(this).toggleClass("open-nav");
- $("#thumb-wrapper").toggleClass("the-margin");
- $('html,body,#wrapper').animate({scrollTop:0}, 500);
- return false;
- });
- //$('.launch-nav').click(function() {
- // $("#thumb-wrapper").animate({
- // marginTop: 0,
- // }, 1000, function() {
- // $("#thumb-wrapper").animate({
- // marginTop: 40,
- // }, 1000)
- // });
- //});
- $(".scroll-to-menu").click(function(){
- $('html,body,#wrapper').animate({scrollTop:0}, 500);
- return false;
- })
- /*Preventing "ajaxify" for social links*/
- $("#network-menu li a").click(function() {
- window.open(this.href);
- return false;
- });
- // SOCIAL BUTTONS
- $("a.external").click(function() {
- window.open(this.href);
- return false;
- });
- /*******************************************
- * THUMBS HOVER FIX
- ********************************************/
- $('.thumb').hover(function(){
- if(cat== null || cat == "none" )
- $(this).fadeTo(100, 1);
- }, function(){
- if(cat== null || cat == "none" )
- $(this).fadeTo(100, thumbOpacity)
- });
- }); // End document ready
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement