曾经工作过的jquery脚本不适用于jquery 1.4.2 [英] jquery script that used to work is not working with jquery 1.4.2

查看:51
本文介绍了曾经工作过的jquery脚本不适用于jquery 1.4.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

...我不知道为什么.

... and i cant figure out why.

脚本如下:

<script type="text/javascript" src="http://path/to/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
            function openMediaPlayer() {
                $('#flashMovie').animate({'height':'333px'});
            }
            function closeMediaPlayer() {
                $('#flashMovie').animate({'height':'80px'});
            }
            jQuery(function($){
                $('#videoholder').bind('mouseenter', function(){
                    openMediaPlayer();
                });
                $('#videoholder').bind('mouseleave', function(){
                    closeMediaPlayer();
                });
            });
</script>
<div id="videoholder" style="height:80px;width:412px;">
<object width="412" height="80" type="application/x-shockwave-flash" id="flashMovie" name="flashMovie" style="height: 80px;" data="http://path/to/Player.swf"><param name="menu" value="false"><param name="bgcolor" value="#666666"><param name="allowFullscreen" value="true"><param name="flashvars" value="playlistURL=http://path/to/Player/data/playlist.xml"></object>
</div>

简单,简单地调整Flash对象的大小.它适用于较旧的(1.3.2)jQuery版本.动画只是行不通.

pure and simple resizing flash object. It worked with older(1.3.2) jquery verision. The animate just does not work.

谁能告诉我要使它重新工作我应该改变什么?

Can anyone tell me what i should change to get it working again?

艾伦.

推荐答案

没有错误,因为jQuery捕获并丢弃了响应mouseenter/mouseleave的事件处理程序错误(1.4.2中的第2170行). 错误的jQuery!相反,使用mouseover/mouseout可以使您看到错误.

There's no error because jQuery catches and throws away event handler errors in response to mouseenter/mouseleave (line 2170 in 1.4.2). Bad jQuery! Using mouseover/mouseout instead allows you to see the error.

哪个是:行1177上的队列未定义".这是由于先前对queue()的调用失败而引起的,因为在<object>上设置fxqueue数据项的尝试失败. (但是,它没有引发错误来标记失败,而是默默地返回undefined.错误的jQuery!)

Which is: ‘queue is undefined’ on line 1177. This is caused by the previous call to queue() failing, because the attempt to set the fxqueue data item on the <object> fails. (But instead of raising an error to flag the failure, it silently returns undefined. Bad jQuery!)

jQuery 1.4.2无法在<object>上设置data()(在1.3.2成功的地方),因为它故意不这样做:它检查jQuery.noData变量,该变量告诉它<object>元素不能具有在它们上设置了任意('expando')属性,以及jQuery的data()机制,因此动画排队取决于此功能. 错误的jQuery!

jQuery 1.4.2 fails to set data() on <object> (where 1.3.2 succeeds) because it deliberately won't: it checks the jQuery.noData variable which tells it that <object> elements can't have arbitrary (‘expando’) properties set on them, and jQuery's data() mechanism, and hence animation-queuing is dependent on this facility. Bad jQuery!

传统上,浏览器在<object>上使用expandos时遇到了麻烦,但是特别是对于Flash而言,它确实在大多数现代浏览器中都可以工作(即使这是非常糟糕的做法).因此,您可以尝试告诉jQuery关闭并允许您通过以下方式为插件元素设置动画:

Traditionally browsers have had trouble with expandos on <object>, but specifically for the case of Flash, it does actually work in most modern browsers (even if it's pretty bad practice). So you could try telling jQuery to shut up and allow you to animate plugin elements by saying:

jQuery.noData= {};

在致电animate之前的某个时刻.

at some point before calling animate.

这篇关于曾经工作过的jquery脚本不适用于jquery 1.4.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆