我想改用我的HTML裏面的html元素時,我的屏幕尺寸得到低於880px,但是如我所料不工作...使用Jquery交換html元素?
我從一個PHP循環產生我的HTML裏面幾個職位,爲每個崗位,它看起來是這樣的:
<div class="post">
<h1>Lorem ipsum</h1>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</div>
我想做的事時,我的瀏覽器屏幕得到880px及以下,h1和p元素會互相使用jQuery 的insertBefore掉期。
下面是我的代碼:
http://codepen.io/vincentccw/pen/GHnFD?editors=101
將divSwap函數設置爲窗口上resize事件的事件處理函數。 – pmandell
是的,我注意到,我發表了有關頁面加載的評論後,我刪除了評論。很好的答案,但肯定比我更好的解決方案。 – deebs