最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

JQuery is not working after complete load of the page

programmeradmin1浏览0评论

Hi i have a strange problem with wordpress. I have a short JQuery script. The script is working as long as the page is loading. But when the page is finished with loading it's not working anymore and I can't find the prolbem. I tried also to wrap the script in a noconflict wrapper didn't help.

Maybe some more informations... I try to show a title of a grid element in wordpress which i have set to display none.

Thanks for your help

Here some details: Wordpress 5.3.2 Highend Theme 3.6.4

jQuery(document).ready(function(){
 jQuery(".apmstoriespic").mouseover(function(){
    jQuery(this).next(".apmstoriestitle").show();
  });
});

Hi i have a strange problem with wordpress. I have a short JQuery script. The script is working as long as the page is loading. But when the page is finished with loading it's not working anymore and I can't find the prolbem. I tried also to wrap the script in a noconflict wrapper didn't help.

Maybe some more informations... I try to show a title of a grid element in wordpress which i have set to display none.

Thanks for your help

Here some details: Wordpress 5.3.2 Highend Theme 3.6.4

jQuery(document).ready(function(){
 jQuery(".apmstoriespic").mouseover(function(){
    jQuery(this).next(".apmstoriestitle").show();
  });
});
Share Improve this question edited Mar 30, 2020 at 5:30 Martin Körber asked Mar 30, 2020 at 3:49 Martin KörberMartin Körber 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

Hard to say what the problem is without seeing the html structure. Any error in your browser console log ? Might that another jQuery function is already bind to the ".apmstoriespic" class. Maybe try the below instead

jQuery(".apmstoriespic").on('hover',function(){

If you want to skip the jQuery route altogether, there is an easy way to achieve the same result with CSS only

.apmstoriespic + .apmstoriestitle {
    display: none;
 }

.apmstoriespic:hover + .apmstoriestitle {
    display: block;
 }

Hope this help !

发布评论

评论列表(0)

  1. 暂无评论