问题
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
回答1:
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.
回答2:
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.
回答3:
use fire bug in FF to get the CSS class name by doing inspect element
来源:https://stackoverflow.com/questions/4315016/modify-css-to-hide