2015-07-03 39 views
1

我在​​的幫助下排序div。這是完美的工作, ,但當我拖動一個div(其中包含嵌入式內容tweets)並下降到任何地方,它將從DOM中刪除,實際上在刪除tweets blockiframe從控制檯中刪除後。jQuery Sortable不能與twitter一起工作嵌入式推文

這裏是我的腳本

<script> 
    $(function() { 
    $("#sortable").sortable({ 
     update: function (event, ui) { 

       $('.storymode').each(function() { 
       //get the order of div after sort 
       var order = $(this).sortable("toArray", {attribute: 'rowdropid'}).toString(); 

         $.ajax({ 
         // ajax request for saving sortable div in DB 
          .... 
          .... 
         }); 
       }); 
       }, 
    }); 
    }); 
</script> 

HTML代碼

<div id="sortable"> 
<div> 
      <blockquote class="twitter-tweet" align="center"><a href="https://twitter.com/CrazyDogTShirts/status/611263713673392128"></a></blockquote> 
     </div> 
</div> 

腳本Twitter並

!function (d, s, id) { 
     var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https'; 
     if (!d.getElementById(id)) { 
      js = d.createElement(s); 
      js.id = id; 
      js.src = p + '//platform.twitter.com/widgets.js'; 
      fjs.parentNode.insertBefore(js, fjs); 
     } 
    }(document, 'script', 'twitter-wjs'); 

</script> 

看到這裏http://dothejob.in/tw.php

DEMO例子,請給我建議的正確方法是如何排序或拖放iframe的內容

+0

嵌入式微博是一個iframe內。您不能應用任何樣式或將任何JavaScript添加到該嵌入代碼中的任何內容。這意味着你不能讓推文排序。 如果你仍想做到這一點,你必須找到一種方法來將你的推文嵌入到你的網頁,而不是一個iframe。不是在Twitter上自己,但也許是一個API或不同的嵌入方法? – terribleuser

回答

0

嵌入式微博是一個iframe內。您不能應用任何樣式或將任何JavaScript添加到該嵌入代碼中的任何內容。這意味着你不能讓推文排序。

如果你還想做到這一點,你必須找到一種方法來嵌入你的推文到你的網頁,而不是一個iframe。不是在Twitter上自己,但也許是一個API或不同的嵌入方法?

相關問題