开发者

Problem when using jQuery prependTo method to move a Flash object

开发者 https://www.devze.com 2023-04-02 21:46 出处:网络
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 scrol

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');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号