First off, my limitations. I do not have access to the master page(s) or global css (either using SPD or not...). Nor do I have the ability to use managed or global navigation. This is a Team Site and Publishing Features are locked down so I cannot turn them on. So the site in question only has access to "Top Nav Links" which does not allow drag and drop on the site, or layered drop downs in the site settings. I also do not have access to this particular site collection with PowerShell, so those methods are out.
That being said, I am looking for a way to set up a drop down menu. Methods should be JavaScript/jQuery and CSS and most likely using a SP List to determine what links will be used for the top nav and drop downs. (CSOM and REST methods would also work as long as instructions are clear in snippets)
While annoying, the limitations are prohibitive and as such I realize that I will need to apply the js via a SEWP or via file on a CEWP per page I want this nav bar to visible on.
I have spent quite a lot of time looking this up, but it seems everything is forcing the use of master pages/css or just styles currently existing drop downs.
Anyone have any ideas on how to do this? Code snippets greatly appreciated so I do not need to try and develop this from scratch.
Thanks!
EDIT I have come up with a partial solution, but need some help in getting the drop down portion working:
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" language="javascript">
function loadBlogs() {
var ul1 = document.getElementById("zz14_RootAspMenu");
var li1 = document.createElement("li");
li1.appendChild(document.createTextNode("Blogs"));
li1.setAttribute("id", "TNBlogsDD");
li1.setAttribute("class", "static");
ul1.appendChild(li1);
var li2 = document.getElementById("TNBlogsDD");
var ul2 = document.createElement("ul");
var br = document.createElement("br");
ul2.setAttribute("id", "dropList");
li2.appendChild(br);
li2.appendChild(ul2);
var li3 = document.createElement("li");
li3.setAttribute("id", "dlItem1");
var a1 = document.createElement("a");
a1.appendChild(document.createTextNode("Google")); //Name of Link Location
a1.setAttribute("href", "http://www.google.com"); //For URL of link
li3.appendChild(a1);
ul2.appendChild(li3);
document.getElementById("ul2").style.display = "none";
li1.addEventListener("onmouseover", dropListOn);
li1.addEventListener("onmouseout", dropListOff);
};
function dropListOn () {
document.getElementById("dropList").style.display = "block";
};
function dropListOff () {
document.getElementById("dropList").style.display = "none";
};
$(document).ready(loadBlogs);
</script>
Any assistance in editing this so Google does not appear initially and works onmouseover
and disappears onmouseout
would be appreciated