从一个元素复制背景到另一个使用jQuery不工作在Firefox [英] Copy background from one element to another using jQuery not working in firefox

查看:131
本文介绍了从一个元素复制背景到另一个使用jQuery不工作在Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个jsfiddle - http://jsfiddle.net/XcC5d/1/

($'$ p
$ b $ $ $ $'$'$'$'''''。')。('click',function(event){
$('。result' ).css('background',$(event.target).css('background'));
});

当点击前3个.select div时,它会复制背景css值并设置它到红色边框的结果。



这个工程在safari和chrome中,而不是在firefox中。
任何帮助将不胜感激。

解决方案

请尝试以下操作:
$ b $('。')。$('。select')。on('click',function(event){
$('。result')。css('background' ,$(event.target).css('background-image'));
});


Here's a jsfiddle - http://jsfiddle.net/XcC5d/1/

$('.select').on('click', function(event){
    $('.result').css('background', $(event.target).css('background'));
});

When clicking on any of the first 3 .select divs, it copies the background css value and sets it to the result with the red border.

This works in safari and chrome but not in firefox. Any help would be greatly appreciated.

解决方案

Try the following:

$('.select').on('click', function(event){
    $('.result').css('background', $(event.target).css('background-image'));
});

这篇关于从一个元素复制背景到另一个使用jQuery不工作在Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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