<section id="proyectos">
<div class="container">
<h2>Proyectos Recientes</h2>
<div class="recent-projects-wrapper">
<div class="recent-project">
<div class="project-image">
<a class="project-link" href="img/projects/2015/metropolitan1_585.jpg" data-images="img/projects/2015/metropolitan1_850.jpg,img/projects/2015/metropolitan2_850.jpg, img/projects/2015/metropolitan3_850.jpg">
<div class="project-hover-icon">
<svg class="icon icon-plus"><use xlink:href="#icon-plus"></use></svg>
</div>
<div class="project-hover-text">Metropolitan</div>
<img src="img/projects/2015/metropolitan1_585.jpg" alt="Metropolitan">
</a>
<!--Metropolitan Project Info Overlay-->
<div class="hidden">
<h3>Metropolitan</h3>
<h4>Ubicación</h4>
<span>San Pedro Garza García,<br>
Nuevo León</span>
<h4>Servicio</h4>
<span>Interior</span>
<h4>Tipo</h4>
<span>Departamento</span>
<h4>Año</h4>
<span>2015</span>
</div>
<!--Metropolitan Project Info Overlay End-->
</div>
<div class="project-info">
<h3>Metropolitan</h3>
<span class="project-type">Interior, Departamento</span>
<span class="project-year">2015</span>
</div>
</div>
<div class="additional-projects-wrapper">
<div class="additional-project">
<div class="project-image">
<a href="img/projects/2014/arcangeles21_585.jpg" class="project-link" data-images="img/projects/2014/arcangeles21_850.jpg,img/projects/2014/arcangeles22_850.jpg,img/projects/2014/arcangeles23_850.jpg">
<div class="project-hover-icon">
<svg class="icon icon-plus"><use xlink:href="#icon-plus"></use></svg>
</div>
<div class="project-hover-text">Arcángeles II</div>
<img src="img/projects/2014/arcangeles21_585.jpg" alt="Arcángeles II">
</a>
<!--Arcangeles II Project Info Overlay-->
<div class="hidden">
<h3>Arcángeles II</h3>
<h4>Ubicación</h4>
<span>San Pedro Garza García,<br>
Nuevo León</span>
<h4>Servicio</h4>
<span>Interior</span>
<h4>Tipo</h4>
<span>Departmento</span>
<h4>Año</h4>
<span>2014</span>
</div>
<!--Arcangeles II Project Info Overlay End-->
</div>
</div>
</div>
</section>
// ======= PROJECT INFO OVERLAY =======
var $overlay = $("<div id='overlay'>" +
"<button class='close-button btn btn-default'><svg class='icon icon-plus'><use xlink:href='#icon-plus'></use></svg></button>" +
"<div class='container'><div class='row'>" +
"<div class='overlay-project-info col-sm-5 col-md-3'></div>" +
"<div class='overlay-images col-sm-7 col-md-9'></div>" +
"</div></div></div>");
var $prevButton = $("<br><button class='prev-button btn btn-default'>Previous</button>");
var $nextButton = $("<button class='next-button btn btn-default'>Next</button>");
function appendImages(imageSet, altSet){
for (var i = 0; i < imageSet.length; i++){
var images = "<img src='" + imageSet[i] + "' alt='" + altSet + "'>";
$(".overlay-images").append(images);
}
}
function getCurrentProject(current){
currentLink = $(current);
currentImages = $(current).data('images').split(',');
currentAlt = $(current).children('img').attr('alt');
currentInfo = $(current).next().html();
}
function getNextProject(){
// If last 'recent project' go to first 'additional project'
if (currentLink.hasClass('last-recent')){
nextLink = currentLink.parents('.recent-projects-wrapper').nextAll('.additional-projects-wrapper').find('.project-link');
}
// If last 'additional project' loop back to first 'recent project'
else if (currentLink.hasClass('last-additional')) {
nextLink = currentLink.closest('.additional-projects-wrapper').prevAll('.recent-projects-wrapper').find('.project-link');
}
// Otherwise go to next project
else {
nextLink = currentLink.parents('[class*="-project"]').next().find('.project-link');
}
nextImages = nextLink.data('images').split(',');
nextAlt = nextLink.children('img').attr('alt');
nextInfo = nextLink.next().html();
}
$('.project-link').click(function (event) {
event.preventDefault();
getCurrentProject(this);
// Add overlay object to body
$("body").append($overlay);
// Add each image to the overlay
appendImages(currentImages, currentAlt);
// Add project info to overlay
$(".overlay-project-info").html(currentInfo);
// Add buttons to overlay
$(".overlay-project-info").append($prevButton);
$(".overlay-project-info").append($nextButton);
// Remove main scrollbars
$("body").css("overflow", "hidden");
// Show overlay
$overlay.slideDown(1000);
// Close overlay and remove from DOM
$('.close-button').click(function () {
$('body').css('overflow-y', 'scroll');
$overlay.slideUp(1000, function(){
$('.overlay-images img').remove();
$overlay.remove();
});
});
$('.next-button').click(function(){
getNextProject();
$('.overlay-images img').remove();
// Add each image to the overlay
appendImages(nextImages, nextAlt);
// Add project info to overlay
$(".overlay-project-info").html(nextInfo);
// Add buttons to overlay
$(".overlay-project-info").append($prevButton);
$(".overlay-project-info").append($nextButton);
});
});
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |