/**
* this function enlarges the divs by clicking on them
*/
let previous = null,
prevH, prevW, prev;
// needs refactoring
$(".project, .sBlog, .moodBoard, .team").click(function() {
let myDiv = this;
// if (e.target.tagName.includes('IMG')) return;//here we handle the the case we click on an image
if (previous == null) {
//needs refactoring!!!!!!!
} else {
//reset the previous clicked div to its initial state
setNumberOfColumns(previous, 'initial');
previous.style.height = prevH;
previous.style.width = prevW;
previous.style.overflowY = 'scroll';
}
//let's save the div so we can reset it later
previous = this;
prevH = this.style.height;
prevW = this.style.width;
//here we enlarge the div
myDiv.style.overflowY = 'hidden';
myDiv.style.width = '100%';
myDiv.style.height = 'auto';
//here we set the number of columns
setNumberOfColumns(myDiv, '2');
// console.log(this);
//here we get the height of the top menu (needs refactoring set it as gloal variable)
// let menuH = document.getElementById('myMenu').getBoundingClientRect().height;
let y = parseFloat(this.getBoundingClientRect().y) + window.scrollY; //this helps us to get the position of the div to scroll to
window.scrollTo(0, y);
// goTo(0, y);
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.