开发者

jquery position change on click

开发者 https://www.devze.com 2023-04-03 13:28 出处:网络
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 a

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

精彩评论

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