本文介绍了共享点中所有页面的自定义顶部菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

   我已经在HTML页面中创建了一个自定义的顶部"菜单,也为此创建了CSS,我希望将其复制到我网站上的所有页面中.

     i have created an custom Top menu in an HTML page, also CSS for that , i want this to replicated in all the pages in my site 

所以我创建了一个以下脚本,并在母版"页面中引用了该脚本和CSS,但是它不起作用,请建议我,该怎么办.

so i created a below script, and referred the script and CSS in Master page , but it doesn't work, please suggest me , what can be done.

var ismenuexist = false;
var currurl    = window.location.href; 


$(document).ready(function(){

if(currurl =="/sites/Mysite/_layouts/viewlsts.aspx"|| currurl =="/sites/Mysite/_layouts/user.aspx")
{
$(#ctl00_MSO_ContentDiv").css("background-color","white");
}

var existingstr = $(.ms-rte-layoutszone-inner").html();


如果($(.secondmenubar")[0])
{
    //如果类存在
    ismenuexist = true;

其他
{
    //如果类不存在
    ismenuexist = false;
    //alert("hi"));
}

if(existingstr =="&& ismenuexist!= true)
{
$(< br/>< br/>< div id ='loadhtmldiv'></div"") .insertBefore(.ms-rte-layoutszone-inner");


}
否则if(ismenuexist!= true)
{

$(< br/>< br/>< div id ='loadhtmldiv'></div"") .insertBefore(.ms-rte-layoutszone-inner");
}



$(#loadhtmldiv").load("/sites/MySite/SitePages/Topmenu.html"); 

var ismenuexist=false;
var currurl    = window.location.href; 


$(document).ready(function(){

if(currurl=="/sites/Mysite/_layouts/viewlsts.aspx" || currurl=="/sites/Mysite/_layouts/user.aspx")
{
$("#ctl00_MSO_ContentDiv").css("background-color","white");
}

var existingstr=$(".ms-rte-layoutszone-inner").html();


if ($(".secondmenubar")[0])
{
    //if class exists
    ismenuexist=true;

else 
{
    //if class does not exist
    ismenuexist=false;
    //alert("hi");
}

if(existingstr==""&&ismenuexist!=true)
{
$("<br/><br/><div id='loadhtmldiv'></div>").insertBefore(".ms-rte-layoutszone-inner");


}
else if(ismenuexist!=true)
{

$("<br/><br/><div id='loadhtmldiv'></div>").insertBefore(".ms-rte-layoutszone-inner");
}



$("#loadhtmldiv").load("/sites/MySite/SitePages/Topmenu.html"); 



});



});

预先感谢

推荐答案

您是否还在母版页中包含了jquery?

Did you included the jquery also in the masterpage?

您遇到任何脚本错误吗?

Are you getting any script errors?


这篇关于共享点中所有页面的自定义顶部菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 10:52