CSS javascript帮助 [英] CSS javascript help

查看:52
本文介绍了CSS javascript帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用搜索结果页面布局的搜索中心结果页面具有 

The search center result page which uses searchresults page layout having 

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
    <SharePoint:StyleBlock runat="server"> 
        #s4-titlerow
        { 
            display: none !important; 
        }
		#titlerow
        { 
            display: none !important; 
        }
		<% 	
			WebPartManager webPartManager = SPWebPartManager.GetCurrentWebPartManager(this.Page);
			if (webPartManager != null && webPartManager.DisplayMode == SPWebPartManager.BrowseDisplayMode)
			{ 
		%>
				#s4-ribbonrow
				{ 
					display: none;
				}
		<%			
			}
		%>

    </SharePoint:StyleBlock>
</asp:Content>

主页面有一个javascript,用于检查搜索结果页面并使用display:block覆盖s4-titlerow。  

The master page has a javascript which check for the search result page and override the s4-titlerow with display:block. 

 <script type="text/javascript">
                var url = window.location.href.toLowerCase();
                var host = window.location.host.toLowerCase();
                $(document).ready(function () {
                    var j = document.getElementById("s4-titlerow");
                    if (url.indexOf('search/pages/') > -1) {
                        if (url.indexOf("results.aspx") > -1) {                       
                        j.style.cssText = "display:block !important;";    
                        }
                    }
                });
</script>

这适用于IE。但不是Chrome。 IE为s4-titlerow div增加了display:block!important,但Chrome在布局页面中从css中选择了none!important。为什么不使用chrome?

This works fine with IE. But not in Chrome. IE adds display:block !important to the s4-titlerow div, but Chrome picks up the none !important from the css in layout page. Any reasons why not working on chrome?

谢谢

Venkat

推荐答案

这对我有用..

This worked for me..

(function () { "use strict"; /* SharePoint equivalent of jQuery


(文档).ready()函数。* /
/ *当页面准备就绪时可以执行多个功能* /
_spBodyOnLoadFunctionNames
" gsPageLoaded" );
})();

/ *加载页面时启动* /
功能 gsPageLoaded () {
" use strict" ;
/ *我们在文档就绪后运行它,但是SharePoint脚本是按需脚本,所以这样就可以确保加载脚本* /
SP
SOD executeFunc 'sp.js' 'SP.ClientContext' gsMain
}

功能 gsMain () {
console
日志 " SharePoint ready!" );
}
( document ).ready() function. */ /* It is possible to push more than one function to be executed when page is ready */ _spBodyOnLoadFunctionNames.push("gsPageLoaded"); })(); /* Started when page is loaded */ function gsPageLoaded() { "use strict"; /* We run it after document ready, but SharePoint scripts are on demand scripts, so this the way to make sure script is loaded */ SP.SOD.executeFunc('sp.js', 'SP.ClientContext', gsMain) } function gsMain() { console.log("SharePoint ready!"); }

参考: https://sharepoint.stackexchange.com/questions/76350/referncing-a-javascript-file-inside-my-master-page-will -not-fire

Ref: https://sharepoint.stackexchange.com/questions/76350/referncing-a-javascript-file-inside-my-master-page-will-not-fire


这篇关于CSS javascript帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆