orchard 1.5, Menu.cshtml, , , , . CSS Site.css, CSS, . Menu.cshtml ( "" ).
@
{
Script.Require("jQuery");
var tag = Tag(Model , "ul");
var items = (IList<dynamic>)Enumerable.Cast<dynamic>(Model.Items);
}
@{//if the menu contains 3 items, render a nav called 'ThreeItemNav'
if(items.Count == 3){
<nav id="ThreeItemNav">
@tag.StartElement
@* see MenuItem shape template *@
@DisplayChildren(Model)
@tag.EndElement
</nav>
}
else if(items.Count == 4){
<nav id="FourItemNav">
@tag.StartElement
@* see MenuItem shape template *@
@DisplayChildren(Model)
@tag.EndElement
</nav>
}
else if(items.Count == 5){
<nav id="FiveItemNav">
@tag.StartElement
@* see MenuItem shape template *@
@DisplayChildren(Model)
@tag.EndElement
</nav>
}
}
//Include the jQuery to add animations to the navigation menu
@using (Script.Foot())
{
<script type ="text/javascript">
$(document).ready(function () {
$(" #FiveItemNav li").hover(function () {
});
$(" #FourItemNav li").hover(function () {
});
$(" #ThreeItemNav li").hover(function () {
});
});
</script>
}
, CSS nav (ThreeItemNav, FourItemNav FiveItemNav), , Site.css:
#ThreeItemNav li
{
background-color:#263A79;
}
#ThreeItemNav a:hover
{
border-right:1px solid #333;
border-left:1px solid #333;
}
#ThreeItemNav > ul li.current
{
background:#5882FA;
}
#FourItemNav li
{
background:#Purple;
}
#FourItemNav a:hover
{
background:Orange;
}
.........more styles
, , , , , Orchard - CSS jQuery. , . , . Orchard 1.5, .
Menu.cshtml MenuItem.cshtml , Orchard, , /.