javascript - jQuery 问题与谷歌浏览器中的表单和鼠标悬停

标签 javascript jquery google-chrome iframe

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

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

计算示例是根据裁剪 View 的左侧偏移量计算图像的左侧偏移量。

我检查了 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());
   });
});

最佳答案

chrome 中的图像在这个特定的浏览器中没有使用宽度和高度。 相反,我将原始宽度和高度乘以比例 X 和 Y。

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

我希望这对某人有帮助。

谢谢你的帮助马可

关于javascript - jQuery 问题与谷歌浏览器中的表单和鼠标悬停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7846304/

相关文章:

php - SQL 错误或 PHP 错误在我的 ajax [object object] 中返回

html - 如何为chrome设置复选框颜色

html - 使用 CSS 'backdrop-filter:blur' 在 Chrome 中呈现/闪烁/故障问题

javascript - Chrome 扩展加载 Jquery 时出错

javascript - 使用 Node.js 框架使用 JavaScript 将数据从 Mongodb 传递到 HTML 表

javascript - 使用 Javascript 或 JQuery 从对象列表中获取所有值

javascript - 如何将图像直接从 Flask 服务器发送到 html?

javascript - JSON数组与键值JSON结构

jQuery 插件 : Validation explain this code please

javascript - 更改 iFrame 的全部内容