Last active
September 4, 2018 20:14
-
-
Save avishai84/d582a1f095279f43fc9ec3dd9cb3d84b to your computer and use it in GitHub Desktop.
facet-2018
This file contains hidden or 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
| function theNewFacetFn(cid){ | |
| this.cid=cid; | |
| let pageIdHash = '#pageId=0'; | |
| let origPageLocHash = window.location.hash; | |
| if(origPageLocHash.length > 0){ | |
| //check if hash already exist in URL | |
| //To stay consistent, loop to find if style exist in array. | |
| // remove it and put back the string at the end. | |
| origPageLocHash = origPageLocHash.split('&'); | |
| var tempArr = []; | |
| origPageLocHash.map(function(item){ | |
| if(item.indexOf('style=') > -1){ | |
| //don't style push to array | |
| }else{ | |
| tempArr.push(item); | |
| } | |
| }); | |
| //join results of the new string | |
| tempArr = tempArr.join('&'); | |
| origPageLocHash= '#style='+cid+'&'+tempArr; | |
| }else{ | |
| origPageLocHash='#style='+cid+'&pageId=0'; | |
| } | |
| location.hash =origPageLocHash; | |
| var topPos = document.querySelector('.l--cat-page-photos').offsetTop; | |
| jQuery("html, body").animate({ | |
| scrollTop : topPos - 150 | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment