使用 jquery 选择器获取 uibinder 元素在 chrome/safari 上失败
我有像下面这样的uibinder html元素,
<g:HTMLPanel>
<div class='thumbnailWrapper'>
<ul>
<li>
<a href='#'><img src='41546-140.jpg' /></a>
<div class='caption'>
<p class='captionInside'>testing javascript</p>
</div>
</li>
<div class='clear'></div><!-- clear the float -->
</ul><!-- end unordered list -->
</div><!-- end spolightWrapper div -->
<script>
jQ_Zoom();
</script>
</g:HTMLPanel>
我的javascript在firefox中执行没有问题,即。但在野生动物园/ chrome,javascript不被调用。看看我上传的样本 在 http://bit.ly/ayuFc1 。尝试用firefox打开并比较 chrome/safari
我的 javascript
function jQ_Zoom(){
alert('yoyo');
alert($('.thumbnailWrapper ul li').find('img').height());
}
i have uibinder html element like below
<g:HTMLPanel>
<div class='thumbnailWrapper'>
<ul>
<li>
<a href='#'><img src='41546-140.jpg' /></a>
<div class='caption'>
<p class='captionInside'>testing javascript</p>
</div>
</li>
<div class='clear'></div><!-- clear the float -->
</ul><!-- end unordered list -->
</div><!-- end spolightWrapper div -->
<script>
jQ_Zoom();
</script>
</g:HTMLPanel>
my javascript have no problem executed in firefox,ie. but in safari/
chrome, the javascript is not call. have a look at my uploaded sample
at http://bit.ly/ayuFc1 . try open with firefox and compared with
chrome/safari
my javascript
function jQ_Zoom(){
alert('yoyo');
alert($('.thumbnailWrapper ul li').find('img').height());
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您将
标记直接放入 UiBinder xml 中,这看起来不正确。我认为正确的解决方案是:
调用(在 UiBinder 之外)。
第一个选项是将本机 Javascript 与 GWT 集成的首选方法。
It looks like you are putting the
<script>
tag directly in your UiBinder xml, that doesn't look right. I think the correct solution is either:<script>
call in your HTML file (outside of the UiBinder).The first option is the preferred method of integrating native Javascript with GWT.