修改CSS隐藏

发布于 2024-10-05 08:47:04 字数 316 浏览 0 评论 0原文

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

有人可以帮我找到我需要放置这个的正确位置吗?我找到了这个 .ms-actionbar 但不知道这个家伙是否属于列表工具栏或站点工具栏。

例如: http://www.xsolive.com/Shared%20Documents/Forms/所有项目.aspx

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

天冷不及心凉 2024-10-12 08:47:04

我总是进行实验。就开始隐藏东西吧。

另外,如果你使用 chrome,打开相关页面,右键单击该元素,然后选择“检查元素”,这将显示它的 id/类等。FF

中有类似的工具,但我并不真正使用 FF除了测试。

I always go with experimentation. Just start hiding stuff.

Also if you use chrome, open up the page in question, right click on the element, and select "Inspect element" this will show you it's id/classes etc.

There are similar tools in FF, but I don't really use FF except for testing.

拥有 2024-10-12 08:47:04

在FF中使用fire bug通过检查元素来获取CSS类名

use fire bug in FF to get the CSS class name by doing inspect element

未蓝澄海的烟 2024-10-12 08:47:04

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

.ms-menutoolbar td 
{
    display:none;
}

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

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

#zz8_ListActionsMenu_t 
{
    display:none;
}

对于您的问题:

不使用 css,您就不能。 “操作”菜单由 SharePoint 动态生成,其 ID 并不总是相同。
不过你可以用 javascript 来完成。

下面是使用 jQuery 的方法:

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

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

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

jQuery 代码的作用是,它首先找到所有带有以 ListActionsMenu 结尾的 ID(应将选择范围限制为工具栏的内容),然后找到带有文本“Action”的 ID。
然后它会删除整个 div。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文