开发者

jquery selector on Drupal logo id

开发者 https://www.devze.com 2023-04-01 05:21 出处:网络
I want to make div id=\'logo\' clickable with jquery using .click function.Unfortunately logo id is completely covered by id=header.Is there a jquery way to isolate the logo div from header div?

I want to make div id='logo' clickable with jquery using .click function. Unfortunately logo id is completely covered by id=header. Is there a jquery way to isolate the logo div from header div?

<div i开发者_运维知识库d='header'>
  <div id='logo'>
  </div>
</div>


Ususally Drupal will link the logo to your front page, so this is likely not a jQuery issue, but a CSS one.

There are several things involving CSS: you could move the logo to some other place within the HTML structure: $('#logo').appendTo('some selector') You would then have to tell the #logo to visually go back to its position (for example set coordinates using CSS)

If, for some reason some other tag is on top of the logo, you might have success with the z-index property.


If you are thinking clicking on logo div wil trigger the header click event if there is any then you can stop the event propagation on logo click. Try this

$("#logo").click(function(e){
   //Do you stuff here
   e.stopPropagation();
});
0

精彩评论

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