如果我们向下滚动
,我无法添加带导航栏链接的自定义徽标是课程"下拉菜单下拉菜单 - 反转"
网站:http://its-skin.upgates.com
CSS:
.secondlogo {
background-image: url(http://static.its-skin.upgates.com/m/m57daee4256187-sublogo.png);
width: 250px;
height: 54px;
margin-left: auto;
margin-right: auto;
}
这是代码完整代码:
<ul class="nav navbar-nav top-menu top-menu-categories">
{else}
<ul class="dropdown-menu dropdown-inverse" data-designer="d1-2-2-1">
{/if}
{foreach $tree as $category}
<li class="ct_{$category['category_id']} lev-{$level}{if $category['active']} active{/if}{if count($category['childs'])} dropdown{if $level > 1} dropdown-submenu{/if}{/if}" data-target-category="{$category['target_category_id']}">
<a href="{$category['url']}"{if $category["blank_yn"]} target="_blank"{/if} class="TopMenuLink">
{$category['name']}
{if (count($category['childs']))}
<i class="caret"></i>
{/if}
</a>
{if count($category['childs'])}
<button class="btn SubcategoriesLink"><i class="fa fa-chevron-right"></i></button>
{/if}
{include #desktopMenu tree => $category['childs'], level => $level + 1, option => false, colsCount => ceil(count($category['childs'])/$itemsInCol)}
</li>
{/foreach}
</ul>
答案 0 :(得分:1)
您可以在ul的开头添加另一个包含链接的列表元素
<ul class="nav navbar-nav top-menu top-menu-categories">
<!-- New Element with class logolink -->
<li class="ct_29 lev-1 logolink">
<a href="http://its-skin.upgates.com/" class="TopMenuLink">
Link
</a>
</li>
<li class="ct_29 lev-1" data-target-category="29">
<a href="http://its-skin.upgates.com/krasa-it-s-skin" class="TopMenuLink">
Krása It's Skin
</a>
</li>
...
</ul>
然后只需使用css将徽标放在它前面
.logolink {
background-image: url(http://placehold.it/16x16/ff0000);
background-position: left center;
background-repeat: no-repeat;
padding-left: 20px; /* Adjust to your logo size*/
}
如果您只想要一个没有文字的可点击徽标图片,请将其包裹在超链接<a href="#"><img src="#" /></a>
内,并忘记css中的背景图片。
修改强>
如果您想在用户滚动页面时获得淡入效果,请查看这两个提供此功能的优秀jquery库。
替代方案,您可以使用一些jquery代码淡入。因此,通过将其不透明度设置为0来隐藏徽标(元素),检测视口滚动并在某个时刻将其淡入。在这里找一个有用的例子: https://jsfiddle.net/mwtebtw9/1/
代码取自:http://www.ordinarycoder.com/jquery-fade-content-scroll/