简体   繁体   English

悬停效果js

[英]Hover effect js

Have a question to you all. 有一个问题要问大家。 My problem is that i don't need the hover function on the main site. 我的问题是我不需要主站点上的悬停功能。 I need the price-circle without a hover function. 我需要没有悬停功能的价格环。 The price-circle should be permanent shown on the site. 价格圈应该在网站上永久显示。 Please help me. 请帮我。

A sample site is http://shopper.queldorei.com 一个示例站点是http://shopper.queldorei.com

$('.products-grid .item').live({
        mouseenter: function(){
            if (mobile) return;

$('.hover .price-box', this).css({
                'opacity':0
            });
            if (Shopper.price_circle) {
                if ( !$(this).hasClass('calc-price-box') ) {
                    var padding = Math.floor( ($('.hover .price-box', this).actual('width') - $('.hover .price-box', this).actual('height'))/2 + 15 );
                    $('.hover .price-box', this).css({
                        'padding':padding+'px 15px',
                        'margin':(-(25+padding*2+$('.hover .price-box', this).actual('height')))+'px 0 0 0'
                    });
                    $(this).addClass('calc-price-box');
                }
                var that = this;
                $('.hover', this).show(0, function(){ $('.hover .price-box', that).animate({opacity:1}, 600) } );
            } else {
                $('.hover', this).show();
            }

            $(this).addClass('no-shadow');

        },
        mouseleave: function(){
            if (mobile) return;
            $('.hover', this).hide();
            $(this).removeClass('no-shadow');
        }
    });

Here is a quick hacky fix: 这是一个快速的修正程序:

在此处输入图片说明

As you can see: I modified the div class hover to include the property display: block!important - which overrides any quircky js / css your theme is using. 如您所见:我修改了divhover以包括属性display: block!important覆盖了您的主题正在使用的所有quickky js / css。 This is not ideal but it gets the job done :) 这不是很理想,但是可以完成工作:)

In short, add this to your css: 简而言之,将此添加到您的CSS:

li.item div.hover { display:block!important; }  /* danger, danger! hacky lol */

you might actually want to add this hack into your html after the JS has loaded. 您实际上可能希望在JS加载后将此hack添加到您的html中。 maybe wrap it in style tags just above the closing </body> tag. 也许将其包装在</body>标记上方的style标记中。

Also you have to remove the 'onmouseleave' event handler, just comment it all out or delete it. 另外,您必须删除“ onmouseleave”事件处理程序,只需将其全部注释掉或将其删除即可。 you wont need it anymore. 您将不再需要它。

If your theme is using JS to handle hovering (which by god, why? css can do this) then we'll need to dig deep in your theme in find every instance of hover and modify it. 如果您的主题使用JS处理悬停(天哪,为什么?css可以做到这一点),那么我们将需要深入挖掘您的主题以找到每个hover实例并对其进行修改。

What I would recommend is finding all instances of :hover in your css source code, also looking for it in js as well, then removing it there. 我建议在css源代码中找到:hover所有实例,也在js中查找它,然后将其删除。

(personal opinion, this is why buying themes is often the worse thing, they always come with quircks :)) (个人观点,这就是为什么购买主题通常是更糟糕的事情,它们总是伴随着敲击声:))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM