在resize上删除jquery克隆项

时间:2013-12-23 09:25:40

标签: jquery resize responsive-design clone

从菜单中克隆一个项目,以便在响应式网站中显示加载时使用jquery函数,如下所示

if ( $(window).width() <= 699 ) {
$(".navigation li.cart").hide();
$(".navigation li.cart a").clone().insertAfter(".top nav");
} else{
    $(".navigation li.cart").show();
$(".top > a:nth-child(3)").hide() // this is cloned item i want to remove
    }

// ==== On Resize functions
$(window).resize(function() {


if ( $(window).width() <= 699 ) {
    $(".navigation li.cart").hide();
    $(".navigation li.cart a").clone().insertAfter(".top nav");
    } else{
        $(".navigation li.cart").show();
    $(".top > a:nth-child(3)").hide() // this is cloned item i want to remove
        }

});

请帮帮我 感谢...

1 个答案:

答案 0 :(得分:0)

看看.top&gt; a:nth-​​child(3)是hide并且不创建clone