I'm using the jQuery prependTo method to move a Flash ad box from the bottom of the page to near the top. When I load the page, the ad box is now near the top of the page as expected, but when I scroll down to the bottom of the page, there is another ad box in the original position, which we don't want.
This is the code. The Flash advert is in a div class called MPU, and I'm prepending it to the .editorial div, which is near the top of the page.
<script 开发者_StackOverflow社区type="text/javascript">
jQuery("div.mpu").prependTo(".editorial");
</script>
Can anyone suggest a way of getting rid of the superfluous Flash ad which still appears at the original position?
You need to detach the box first:
jQuery('div.mpu').detach().prependTo('.editorial');
精彩评论