Animation Direction - Ext JS

本文讨论了如何在网页应用中调整元素动画的方向,特别是针对元素在页面右侧展开时导致页面滚动条出现的问题。通过同时动画化宽度和位置属性,实现了从右上角向左下角平滑展开的效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I am using this function

cBox.setSize(imgSize.width,imgSize.height,true);

is there a way to tell the animation which direction to do.

What my problem is is that the box that expands that sits on the right side of the page will expand the window and cause to you have to scroll right to see it.

i basicly want to anchor it to the top right and have it expand out to the top left.


just select an item from the gird and add it to box 2 or 4 and then click on the box and you will see what i mean.

Thanks.

**edit** removed link.
__________________
Jon
Web Application Developer - Indianapolis Motor Speedway
bombdiggity.net
Reply With Quote
  #2  
Old 03-06-2007, 10:19 AM
Default

Width has no "direction".

Really what you want is two concurrent animations.

Animate the left style attribute downwards, and the width upwards.
Reply With Quote
  #3  
Old 03-06-2007, 11:36 AM
Default

Quote:
Originally Posted by Animal
Width has no "direction".

Really what you want is two concurrent animations.

Animate the left style attribute downwards, and the width upwards.
Ok that make some sense to me. can you give me an example?

Thank Animal!

**Edit**

I got it working now animal. Thanks again!!!
__________________
Jon
Web Application Developer - Indianapolis Motor Speedway
bombdiggity.net
Reply With Quote
  #4  
Old 03-06-2007, 01:15 PM
Default

Hey Jon,

Just wanted to point out that using Element.slideOut/In, you can pass an anchor as a parameter to control exactly what you're trying to do. Check out the Fx class for details.

Brian
__________________
Brian Moeskau
FAQ / Tutorials / User Extensions / Enhanced Forum Search
Reply With Quote
  #5  
Old 03-06-2007, 02:06 PM
Default

Thanks guys.

With some help from Jack I got this figured out.

Here is what i came up with when the box is clicked.

var imgSize = Ext.fly(img[0]).getSize();
var xy = cBox.getXY();
if(cBox.hasClass('expanded')) {
	// we are expaned, do collapse
	if(cBox.hasClass('rightBox')) {
	    cBox.setBounds(xy[0]+(imgSize.width-340),xy[1],342,152,{callback: function() {
		    this.setStyle('position','');
		    this.removeClass('expanded');
		}}
	    );
	} else {
	    cBox.setBounds(xy[0],xy[1],342,152,{callback: function() {
		    this.setStyle('position','');
		    this.removeClass('expanded');
		}});
	}
} else {
	cBox.setStyle('position','absolute');
	if(cBox.hasClass('rightBox')) {
	    cBox.setBounds(xy[0]-(imgSize.width-340),xy[1],imgSize.width,imgSize.height,true);
	} else {
	    cBox.setBounds(xy[0],xy[1],imgSize.width,imgSize.height,true);
	}
	cBox.addClass('expanded');
}
__________________
Jon
Web Application Developer - Indianapolis Motor Speedway
bombdiggity.net
Reply With Quote
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值