www.webdeveloper.com
Results 1 to 2 of 2

Thread: Why is this selector not working?

  1. #1
    Join Date
    Jan 2012
    Posts
    7

    Why is this selector not working?

    I'm writing a simple script that replaces two images. The first one swaps in fine, but the second one for some reason will not fire. It's got to be something simple that I'm missing. Maybe the 'div.singleTint img' selector? Can someone take a look and double check my work?

    Here's my html
    HTML Code:
    <div id="beerGlassOverlay">
    	<img src="<?php bloginfo('template_directory'); ?>/images/beerOverlay.png" class="glassreplace">
    </div>
    
    <li class="image-rollover">
    	<a href="http://brasco.co/Mims/meet-the-breweries/miller-beers/" target="_blank">
    		<img width="177" height="186" src="http://brasco.co/Mims/wp-content/uploads/2012/05/miller1.png" class="attachment-full wp-post-image" alt="miller" title="miller" />
    	</a>
        <div class="singleTint">
            <img width="279" height="524" src="http://brasco.co/Mims/wp-content/uploads/shrekBeer.png" class="attachment-full" alt="shrekBeer" title="shrekBeer" />  
        </div><!-- End singleTint-->
    </li>
    Here's my jQuery
    Code:
    $('li.image-rollover').mouseover(function() {	
    	$('img.glassreplace').attr({//Change the src and size info on hover			
    		src: ('div.singleTint img', this).src,
    		width: '100%',
    		height: '100%'
    		});
    	});

  2. #2
    Join Date
    Jan 2012
    Posts
    7
    This has been resolved by changing the code to
    Code:
    src: $('div.singleTint img', this).attr('src'),

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles