Last active
October 12, 2020 14:55
-
-
Save alexisnomine/7707695 to your computer and use it in GitHub Desktop.
Breadcrumb when navigating folders in a Sharepoint 2010 Document Library WebPart.
(Pure JS, No jQuery, IE8+)
Can be inserted via a "HTML Form Web Part" or referenced in a custom masterpage.
@tyty4u2 @smkukhcit @alexisnomine
I made a small change to the code to get it to work in our environment... not sure if it's because I'm on SP2016 or because I'm on a wiki style page but this worked great:
if(rootStr.indexOf(link) != -1){
var path = rootStr.replace(link, ''); // Folder path, relative to Doc Lib
var basepath = rootStr.replace(path, ''); // Doc Lib path
//2020-10-12 @mikezimm: Added padding-left in span style to get some spacing
var breadcrumb = '<span style="padding-left: 30px" class="breadcrumb">';
//2020-10-12 @mikezimm: Change "Home" to "Top (to make less confusing to me)
breadcrumb += '<a href="' + location.pathname + '">Top</a>'; // link to base page
// Create link for each sub-folder
var folders = path.split('/');
for(var i = 1; i < folders.length; i++){
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am sorry, but I am new to SharePoint customization. Can you tell me where I can find specific instructions on how to implement these like your breadcrumb post? I'd really like to implement this but am not sure how to do that.
Thanks!