开发者

jquery position change on click

I have a logo on a site I want that when I will be on home page it will at the same position where it is but开发者_高级运维 when I will go to another page it's position will change some towards top and on all other pages except home page it position will be fixed so that when I will scroll the page it will be fixed at a position.


$(document).ready(function() {
    if (document.URL == "Your Homepage Address") {
        $("#your-image-id").removeClass("class-used-for-all-pages").addClass("class-used-for-homepage");
    }
});

Hope this helps


In PHP it would be something like:

<div class="logo" id="<?php if($page=="home")echo 'normalhome';else echo 'fixedotherpagepwn';?>">LOGO</div>

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜