shareThis 기능을 구현할 수있는 다음 코드가 있습니다. 내가 뭘 하려는지이 오버레이 공유의 닫기 버튼을 클릭했을 때 .share-span
과 함께 제공되는 shareThis 기능을 제거한 다음 다시 초기화하지만 remove()
은 DOM에서 .span-share
을 제거하지 않는 것 같습니다.jquery remove() 제거하지 않음
<script type="text/javascript">
function getShareData() {
jQuery(".suit-gallery-btn").each(function(index){
jQuery(this).children().remove('span');
jQuery(this).append("<span class='share-span'></span>"); // ShareThis button will be inserted in this span, which we are appending to each <div class="suit-gallery-btn">
var suitLink = jQuery(this).find('a'); // the "click more information" link. you will need the href and title from this element.
console.log(suitLink);
stWidget.addEntry({
"service":"email",
"element": jQuery(this).find('.share-span')[0],
"title":suitLink.attr('title'),
"type":"large",
"text":suitLink.attr('title'),
"image": suitLink.attr('href'),
"summary":suitLink.attr('title'),
"onhover": false
});
});
}
jQuery(document).ready(function() {
getShareData();
jQuery("#closeX, #greyScreen, .stCloseNew2, .close, .close2").live("click", function(){
getShareData();
});
});
<div id="suit-gallery">
<img src="../images/galleries/business/DSC_0055_sm.jpg" alt="Stylish button 3 business suit, beige lightweight high twist cool wool Holland & Sherry" width="164" height="247" />
<div class="suit-gallery-btn">
<a href="../images/galleries/business/DSC_0055.jpg" rel="lightbox[business]" title="Stylish button 3 suit, beige lightweight high twist cool wool Holland & Sherry from £695 choice of 90 designs and colours">Click for more information</a>
</div>
</div>
dom의 예를 들어 주시겠습니까? –