2015-08-18 4 views
1

У меня есть div «div.share-tools», который я хочу внутри «div.single-column div.middle». Я использую «append» для этого. но он не работает.Вставить div в другое место div

Мне нужна помощь в этом.

j$(document).ready(function() { j$('div.single-column div.middle').append('div.share-tools'); });
.share-tools { 
 
\t width: 20%; 
 
\t padding: 0; 
 
\t margin: 0; 
 
\t z-index: 999; 
 
\t position: relative; 
 
\t top: 7px; 
 
\t left: 830px; 
 
\t text-align: center; 
 
} 
 
.form-page .share-tools { 
 
\t display: none; 
 
}
<div class="share-tools"> 
 
    <p><strong>Follow Bar</strong> 
 
    </p> 
 
    <span class="st_facebook_custom" st_processed="yes"><a target="_blank" href="https://www.youtube.com/user/FIPPmagazines"><img onclick="ga('send', 'event', 'Facebook', 'ArticleShare', 'Middle East focus: Evolving editorial for a growing market')" alt="" src="https://custom.cvent.com/87E7E574200F45ABB2697C8CB2E584DC/pix/8756b08d940b444ba9d069a53936ae71.png"></a></span> 
 
    <span 
 
    st_via="FIPPWorld" class="st_twitter_custom" st_processed="yes"> 
 
    <a target="_blank" href="https://twitter.com/intent/tweet?text=Middle%20East%20focus%3A%20Evolving%20editorial%20for%20a%20growing%20market&source=sharethiscom&related=sharethis&via=FIPPWorld&url=http://fipp.com/news/features/middle-east-focus-james-hewes#sthash.dx3fgoZo.uxfs"> 
 
     <img onclick="ga('send', 'event', 'Twitter', 'ArticleShare', 'Middle East focus: Evolving editorial for a growing market')" alt="" src="https://custom.cvent.com/87E7E574200F45ABB2697C8CB2E584DC/pix/54596e96875044318f6a6bcbb4fde4be.png"> 
 
    </a> 
 
    </span> <span class="st_facebook_custom" st_processed="yes"><a target="_blank" href="https://www.facebook.com/login.php?next=https%3A%2F%2Fwww.facebook.com%2Fsharer%2Fsharer.php%3Fu%3Dhttp%253A%252F%252Ffipp.com%252Fnews%252Ffeatures%252Fmiddle-east-focus-james-hewes%26ret%3Dlogin&display=popup#sthash.dx3fgoZo.gbpl&t=Middle%20East%20focus%3A%20Evolving%20editorial%20for%20a%20growing%20market"><img onclick="ga('send', 'event', 'Facebook', 'ArticleShare', 'Middle East focus: Evolving editorial for a growing market')" alt="" src="https://custom.cvent.com/87E7E574200F45ABB2697C8CB2E584DC/pix/d01f0a803ded492097d8c21a7bd0cb0e.png"></a></span> 
 
    <span 
 
    displaytext="LinkedIn" class="st_linkedin_custom" st_processed="yes"> 
 
     <a target="_blank" href="https://www.linkedin.com/uas/login?session_redirect=https%3A%2F%2Fwww%2Elinkedin%2Ecom%2FpostLogin%3Fsession_rikey%3DoIQlgRWQjbUR1XC6Rj7g3fkHJfBz4LiPftHLQjaFY8b4VvsaI3Dk5jBausr4PNRzPjiLqp_H0zUPz1Mc3Tewv34SajutVuIf2Kh%26l%3Dhttps%253A%252F%252Fwww%252Elinkedin%252Ecom%252FshareArticle%253Fmini%253Dtrue%2526url%253Dhttp%25253A%25252F%25252Ffipp%25252Ecom%25252Fnews%25252Ffeatures%25252Fmiddle-east-focus-james-hewes%25253Fsthash%25252Edx3fgoZo%25252Emjjo%2526source%253D%2526title%253DMiddle%252BEast%252Bfocus%25253A%252BEvolving%252Beditorial%252Bfor%252Ba%252Bgrowing%252Bmarket%2526summary%253DConsumer%252Bpublishing%252Bin%252Bthe%252BMiddle%252BEast%252Bis%252Bon%252Bthe%252Bup%25252E%252BThe%252BUAEs%252Bcontinues%252Bto%252Blead%252Bthe%252Bregion%2525E2%252580%252599s%252Bmedia%252Bscene%25252E%252BWith%252Ba%252Bmedian%252Bage%252Bof%252Bjust%252B30%252Band%252Ban%252Binternet%252Bpenetration%252Brate%252Bof%252B96%252Bper%252Bcent%252Bof%252Bthe%252Boverall%252Bpopulation%25252C%252Bit%2525E2%252580%252599s%252Bno%252Bsurprise%252Bthat%252Bmuch%252Bof%252Bthe%252Bgrowth%252Bin%252Bmagazine%252Bmedia%252Bin%252Bthe%252BUAE%252Bis%252Btaking%252Bplace%252Bonline%25252E%26id%3D0%26b%3D95999708-0136-417e-83c6-48cb7d2e6826%26h%3DeeQp%26m%3DGET"> 
 
     <img onclick="ga('send', 'event', 'LinkedIn','ArticleShare', 'Middle East focus: Evolving editorial for a growing market')" alt="" src="https://custom.cvent.com/87E7E574200F45ABB2697C8CB2E584DC/pix/0e01af7e76e3461e9c6d38361580d0ef.png"> 
 
     </a> 
 
     </span> <span displaytext="Google +" class="st_googleplus_custom" st_processed="yes"><a target="_blank" href="https://accounts.google.com/ServiceLogin?service=oz&passive=1209600&continue=https://plus.google.com/share?url%3Dhttp://fipp.com/news/features/middle-east-focus-james-hewes%2523sthash.8wcUbxKy.hpvt%26hl%3Den-US%26gpsrc%3Dframeless&btmpl=popup&hl=en-US#identifier"><img onclick="ga('send', 'event', 'GPlus', 'ArticleShare', 'Middle East focus: Evolving editorial for a growing market')" alt="" src="https://custom.cvent.com/87E7E574200F45ABB2697C8CB2E584DC/pix/eefab194c0204b56834abefa73cbf677.png"></a></span> 
 
     <span 
 
     displaytext="Google +" class="st_googleplus_custom" st_processed="yes"> 
 
     <a target="_blank" href="https://instagram.com/FIPPworld"> 
 
      <img onclick="ga('send', 'event', 'GPlus', 'ArticleShare', 'Middle East focus: Evolving editorial for a growing market')" alt="" src="https://custom.cvent.com/87E7E574200F45ABB2697C8CB2E584DC/pix/2bc43366f1744a29a26652b2ff4b298a.png"> 
 
     </a> 
 
     </span> <span displaytext="Google +" class="st_googleplus_custom" st_processed="yes"><a target="_blank" href="https://www.pinterest.com/FIPPWorld/"><img onclick="ga('send', 'event', 'GPlus', 'ArticleShare', 'Middle East focus: Evolving editorial for a growing market')" alt="" src="https://custom.cvent.com/87E7E574200F45ABB2697C8CB2E584DC/pix/fea31ed44c944e8fbaaf5ec2c2114687.png"></a></span> 
 
</div>

+0

Включили ли вы библиотеку jquery, и я не на это 100%, но я не видел переменную перед символом $, как вы это делали, с буквой «j». – IfTrue

+0

Я включил jquery и j $ упоминается без конфликтов –

+0

@IfTrue это можно сделать с помощью 'var j $ = jQuery; или var j $ = jQuery.noConflict(); ' – Jai

ответ

1

Append JQuery ожидает элемент, а не селектор.

<script> j$(document).ready(function() { j$('div.single-column div.middle').append(j$('div.share-tools')); }); </script> 
+0

Небольшая ошибка, если вы можете исправить это, это будет ответ. – Jai

Смежные вопросы