开发者

uibinder element get with jquery selector fail on chrome/safari

开发者 https://www.devze.com 2023-01-13 16:39 出处:网络
i have uibinder html element like below <g:HTMLPanel> <div class=\'thumbnailWrapper\'> <ul>

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开发者_Go百科 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());

}


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:

  1. Wrap the Javascript function in a JSNI call.
  2. Make your Javascript <script> call in your HTML file (outside of the UiBinder).

The first option is the preferred method of integrating native Javascript with GWT.

0

精彩评论

暂无评论...
验证码 换一张
取 消