修改CSS隐藏 [英] Modify CSS to hide

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

问题描述

我需要从文档库的工具栏中隐藏操作"菜单.我知道在 CSS 中我可以使用{display: none}"语法来隐藏.

有人可以帮我找到合适的地方放这个吗?我找到了这个 .ms-actionbar 但不知道这家伙是属于列表工具栏还是网站工具栏.

例如:http://www.xsolive.com/Shared%20Documents/Forms/AllItems.aspx

解决方案

此 CSS 规则将隐藏工具栏中的元素:

.ms-menutoolbar td{显示:无;}

请注意,这会隐藏工具栏中的所有菜单.如果您想在工具栏中显示其他按钮,则必须对其进行修改.使用该特定按钮的 id 即可.

对于您提供的 URL,规则是:

#zz8_ListActionsMenu_t{显示:无;}

对于您的问题:

不使用 css 你不能.操作"菜单由 SharePoint 动态生成,其 ID 不会始终相同.不过,您可以使用 javascript 来完成.

以下是使用 jQuery 的方法:

$(document).ready(function() {var link = $('a[id$="ListActionsMenu"]').filter(':contains("Actions")');link.parent().hide();});

菜单的 HTML 代码的非常简化版本如下所示:

<a id="zz8_ListActionsMenu">动作</a>

jQuery 代码的作用是,它首先找到 ID 以 ListActionsMenu 结尾的所有 <a>(这应该将选择限制为工具栏的内容),然后找到一个带有文本Action".然后删除整个 div.

I need to hide the "Actions" menu from a document library's toolbar. I know in CSS I can use this "{display: none}" syntax to hide.

Can someone please help find me the right place where I need to put this? I found this .ms-actionbar but dont know if this guy belong to list toolbar or site toolbar.

For example: http://www.xsolive.com/Shared%20Documents/Forms/AllItems.aspx

解决方案

This CSS rule will hide the elements from your toolbar :

.ms-menutoolbar td 
{
    display:none;
}

Note that this will hide all the menus from your toolbar though. If there are other buttons you want to show in the toolbar you'll have to modify it though. Using the id of that particular button will work.

For the URL you provided, the rule would be :

#zz8_ListActionsMenu_t 
{
    display:none;
}

For your question :

Not with css you can't. The "Actions" menu is generated dynamically by SharePoint and it's ID won't always be the same. You can do it with javascript though.

Here is how you would do it with jQuery :

$(document).ready(function() {
    var link = $('a[id$="ListActionsMenu"]').filter(':contains("Actions")');
    link.parent().hide();
});

A very simplified version of the HTML code looks like this for the menu :

<div id="zz8_ListActionsMenu_t">
    <a id="zz8_ListActionsMenu">Actions</a>
</div>

What the jQuery code does is that it first finds all the <a> with an ID that ends with ListActionsMenu (which should limit the selection to the content of the toolbar) and then finds the one with the text "Action". It then removes the whole div.

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

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