I have two images. Both are 160x600 pixels.
One image is displayed by default. On mouseover of that image, the other image needs to slide out from the left. I have it working on a blank page, but whenever I place it with other HTML, the second image will slide out, but will slide back in immediately. If I mouseover the first image a few times, the second image will eventually stay popped-out, but only after hovering mouse cursor over the first image a few times.
Here's my code:
- <script type="text/javascript">
- $(function() {
- $('.slidebttn').hover(
- function () {
- var $this = $(this);
- var $slidelem = $this.prev();
- $slidelem.stop().animate({'width':'320px'},300);
- $slidelem.find('span').stop(true,true).fadeIn();
- $this.addClass('button_c');
- },
- function () {
- var $this = $(this);
- var $slidelem = $this.prev();
- $slidelem.stop().animate({'width':'160px'},200);
- $slidelem.find('span').stop(true,true).fadeOut();
- $this.removeClass('button_c');
- }
- );
- });
- </script>
- <div class="button_wrap">
- <a class="button_aLeft" id="button_aLeft"><span><img border="0" src="images/image2.jpg" /></span></a>
- <a class="button_bLeft slidebttn" id="button_bLeft"><span><img border="0" src="images/image1.jpg" /></span></a>
- </div>
And here's my CSS:
- .button_wrap{
- position:relative;
- height:650px;
- overflow:hidden;
- font-weight:bold;
- font-size:11px;
- }
- .button_aLeft{
- color:#fff;
- text-align:left;
- }
- .button_aLeft span{
- display:none;
- }
- .button_bLeft{
- background-color:#fff;
- position:absolute;
- top:0px;
- right:0px;
- }
Can anyone help me out here?