我有一个包含在iFrame中的页面(其中嵌入了外部html页面),该页面具有一个表单,当鼠标悬停在表单提交按钮上时,它会在提交前计算表单的隐藏值。

另外,我还以(http://codecanyon.net/item/smooth-zoom-pan-jquery-image-viewer/full_screen_preview/511142)的形式使用smoothzoom库。

一个示例计算是相对于裁切视图的左偏移计算的图像左偏移。

我已经检查了chrome和firefox中的元素。

鼠标悬停时,所有隐藏字段都会在Firefox中更新。

在chrome中,只有其中两个会更新。 X和Y。

这是我正在使用的jQuery。

var hovered = false;
$(function(){
   $('#image').smoothZoom({
      width: 270,
      height: 270,
      zoom_MAX: 600,
      animation_SPEED: 0.001,
      animation_SMOOTHNESS: 0,
      initial_ZOOM: '100',
      initial_POSITION: '0 0'
   });
   $('#headerImageCont').hover(function(){
      hovered = true;
   },function(){
      hovered = false;
   });
   $(window).bind("mousewheel", function(event, delta){
      if (hovered === true){
         return false;
      }
   });
   $('#saveButton').mouseover(function(){
      $('#x').val(-$('#image').position().left); //needs to be inverted
      $('#y').val(-$('#image').position().top); //needs to be inverted
      $('#ScaleX').val($('#image').width() / 500);
      $('#ScaleY').val($('#image').height() / 423);
      $('#Scale').val($('#image').width() / 500 * 100);
      $('#target_width').val($('#headerImageCont').width());
      $('#target_height').val($('#headerImageCont').height());
      $('#actual_width').val($('#image').width());
      $('#actual_height').val($('#image').height());
   });
});

最佳答案

镀铬图像在此特定浏览器中未使用宽度和高度。
相反,我将原始宽度和高度乘以比例X和Y。

可以通过此代码使用chromes webkit值来实现。
http://jsfiddle.net/umZHA/

我希望这可以帮助别人。

谢谢您的帮助Marco

07-24 18:00
查看更多