douwang4374 2014-12-08 00:29
浏览 46

添加蒙版到切换菜单

I am trying to add a mask to a toggle menu. The idea being that, when you click on the #toggle button, the menu will slide down and a mask is applied to the content area.

The JS and html / php code I have so far is:

(function($) {
$('#toggle').toggle( 
    function() {
        $('#popout').animate({ top: 0 }, 'slow', function() {
            $('#toggle').html('<img src="http://www.example.com/wp-content/themes/your-theme/images/menu.png" alt="close" />');
        });
    }, 
    function() {
        $('#popout').animate({ top: -600 }, 'slow', function() {
            $('#toggle').html('<img src="http://www.example.com/wp-content/themes/your-theme/images/menu.png" alt="close" />');
        });
    }
);
})(jQuery);

<div id="toggle"><i class="fa fa-bars"></i></div>
<div id="popout">
  <?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'menu_class' => 'nav-menu' ) ); ?>
</div>

Are there any JS pro's who can help out a learner?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码
    • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
    • ¥20 docker里部署springboot项目,访问不到扬声器
    • ¥15 netty整合springboot之后自动重连失效