简体   繁体   中英

Hover on div will affect wordpress widget on other div

Url: 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:

$('.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:

On 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 :

    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

$('.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.

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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