firstLoad

作者: 小张宝 | 来源:发表于2017-11-01 16:51 被阅读0次

在加载ajax出来,为了不消耗资源,可以在class属性上加个firstLoad,当点击完移除firstLoad

然后在控制显示隐藏。

例如

$('.sideBarbox').on('click','.sideMenuName',function(){

var _this =$(this);

_this.addClass('on').parents('.sideParentMenu').siblings().children('.sideMenuName').removeClass('on');

var categoryCode = _this.attr('data-parentCode');$('.sideChildbox').find(".sideChildMenu[data-parentCode='"+categoryCode+"']").show().siblings().hide();

//_this.siblings('.sideChildMenu').show().parents('.sideParentMenu').siblings().children('.sideChildMenu').hide();if(_this.hasClass('firstLoad')){

$.ajax({url:"getCategoryByPCode",

type: "post",

data : {

},

dataType: "json",

success: function (data){

}

})

相关文章

  • firstLoad

    在加载ajax出来,为了不消耗资源,可以在class属性上加个firstLoad,当点击完移除firstLoad ...

网友评论

      本文标题:firstLoad

      本文链接:https://www.haomeiwen.com/subject/eaegpxtx.html