简体   繁体   English

将鼠标悬停在div上会影响其他div上的wordpress小部件

[英]Hover on div will affect wordpress widget on other div

Url: http://revivo.outit.co.il/ 网址: http//revivo.outit.co.il/

Issue: I want when hover on the slider image (with the red sink), the title above it will display:none. 问题:我想将鼠标悬停在滑块图像(带有红色水槽)上时,其上方的标题将显示:无。 The problem is that its two different plugins. 问题在于它有两个不同的插件。

I tried: 我试过了:

.advps-slide:hover ~ .textwidget {
    display: none;  
}

And another try: 另一个尝试:

.advps-slide:hover ~ .main-shaddow{
    display: none;  
}

Also i tried JS: 我也尝试过JS:

$('.advps-slide').mouseover(function() {
   var $this = $(this);
   var id = $this.attr('rel');
   var $currentWidget = $('.' + id);
   $currentWidget.show().siblings('.main-shaddow').hide();
});
$('.main-shaddow').mouseleave(function() {
    $('.textwidget').hide();
});

But nothing. 但是什么都没有。

The Html (at least the part with the widget and the slider: HTML(至少包含小部件和滑块的部分:

On sidebar.php: 在sidebar.php上:

<div class="main-border"><?php echo do_shortcode('[advps-slideshow optset="4"]'); ?></div>
<div class="main-shaddow">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('title-widget') ) :    
?> <?php    endif;  ?></div>

On functions.php : 在functions.php上:

    register_sidebar( array(
    'name'          => __( 'Title-Main-Page', 'revivo_official2' ),
    'id'            => 'title-widget',
    'before_widget' => '<aside id="%1$s" class="widget-title-main">',
    'after_widget'  => '</aside>',
    'before_title'  => '<h1 class="widget-title">',
    'after_title'   => '</h1>',
) );

It's even possible? 可能吗

Here's some jQuery, give it a try 这是一些jQuery,请尝试一下

$('.advps-slide').hover(function() {
    $('.widget-title').toggle();
});

if that don't work , try 如果那不起作用,请尝试

$('.advps-slide').hover(function() {
    $('#title-widget .widget-title').toggle();
});

EDIT: 编辑:

Also, with wordpress you probably have to do this instead. 此外,使用WordPress,您可能不得不这样做。

jQuery('.advps-slide').hover(function() {
    jQuery('.widget-title').toggle();
});

Also , make sure this is somewhere inside your head tags. 另外,请确保这在您的头部标签内。 (it can be from the googleapis url, but other sites host the jquery file too, like jquery.com) (它可以来自googleapis网址,但其他站点也托管jquery文件,例如jquery.com)

<head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>

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

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