1

I'm following this tutorial on making an animation like IKEA:

http://static.buildinternet.com/live-tutorials/interactive-picture/index.html

The issue I'm having is that I would like to make the information expand from right to left when somebody hovers over the image, instead of left to right.

Here is an example on jsfiddle: http://jsfiddle.net/NEHZU/1/

This is the code on jsfiddle:

CSS:

.more{ position:absolute; width:17px; height:17px; background:url('dim.png'); padding:2px; text-align:left; overflow:hidden; }

.more span{ position:absolute; left:32px; width:160px; padding:0px 0 0 0px; color:#000; font:bold 13px Lucida Grande, Arial, sans-serif;  }

#test{ top:50px; left:213px;}

HTML:

<div class="more" id="test">

            <a href="http://www.google.com"><img src="http://buzport.com/wp-content/uploads/2011/07/land-phone-17x17px.gif"/></a>
            <span>random text</span>

        </div>​

JavaScript:

$(".more").hover(function(){
                $(this).stop().animate({width: '225px' },200).css({'z-index' : '10'}); 
            }, function () {
                $(this).stop().animate({width: '17px', height: '17px' }, 200).css({'z-index' : '1'});
              });​

updated title to say Right to Left, instead of Left to Right

4

2 回答 2

1

你在找这个吗?

$(".more").hover(function(){
    $(this).stop()
        .animate({
            width: '225px', 
            left: $(this).find('span').width() 
        }, 200)
        .css({ 'z-index' : '10' }); 
    }, function () {
    $(this).stop()
        .animate({
            width: '17px', 
            left: '213px', 
            height: '17px' 
    }, 200)
    .css({'z-index' : '1'});
});​

http://jsfiddle.net/NEHZU/38/

于 2012-02-20T23:45:20.483 回答
0
$(".etc").hide();

$(".more").hover(函数() {

$(".etc").animate({
    "marginLeft": "-=80px"
}, 200);
$(".etc").show();

}, 功能() {

$(".etc").animate({
    "marginLeft": "+=80px"
}, 200);

$(".etc").hide();

});​</p>

你应该试着玩一下我的 css,我不能,抱歉:))

http://jsfiddle.net/zxJtu/

于 2012-02-21T00:22:30.137 回答