//判斷簡述是否overflow & showmore ;(function($){ $('.briefly-content').each(function(){ let _this = $(this) if(_this[0].scrollHeight > _this[0].clientHeight){ _this.parent('.briefly-box').addClass('with-expand') } }) //showmore $(document).on('click', '.briefly-box', function(){ let _this = $(this), content = _this.find('.briefly-content'), expandBtn = _this.find('.briefly-expand') if(!content.hasClass('briefly-collapse')){ expandBtn.text('show') }else{ expandBtn.text('hide') } content.toggleClass('briefly-collapse') }) $('.CollectBox').click(function(){ var share_id = $(this).data('sid'); var Socure = $(this).data('soc'); var target = $(this); if($(this).hasClass('AddCollect')){ var class_add = 'RemoveCollect'; var class_remove = 'AddCollect'; var Favorites_Flag = 1; var num = 1; }else{ var class_add = 'AddCollect'; var class_remove = 'RemoveCollect'; var Favorites_Flag = 2; var num = -1; } $.ajax({ url:"/member/ajax/ajax_favorites_outfit-p.php", type:"POST", cache:false, async:false, data:{share_id: share_id,Favorites_Flag: Favorites_Flag,Socure: Socure}, success:function(d){ $(target).removeClass(class_remove).addClass(class_add); $(target).find('span').html(parseInt($(target).find('span').html()) + num); } }); }) $('.LikeBox').click(function(){ var share_id = $(this).data('sid'); var page_id = $(this).data('pid'); var target = $(this); $.ajax({ url:"/member/ajax/ajax_like_outfit-p.php", type:"POST", cache:false, async:false, data:{share_id: share_id,page_id: page_id}, success:function(d){ if(d.trim() == '1'){ $(target).find('span').html(parseInt($(target).find('span').html()) - 1); }else{ $(target).find('span').html(parseInt($(target).find('span').html()) + 1); } } }); }) })($)