返回首页

没关系 - 我想为iPhone开关使用jQuery插件。但IE浏览器中显示的背景图片的问题。

下面是代码,这是造成麻烦的 -


	image = jQuery('<img class="iphone_switch" style="height:'+settings.switch_height+'px; width:'+settings.switch_width+'px; background-image:url('+settings.switch_path+'); background-repeat:none; background-position:'+(state == 'on' ? 0 : -53)+'px" src="'+(state == 'on' ? settings.switch_on_container_path : settings.switch_off_container_path)+'" />');

 


当我从上面的代码
background-position:'+(state == 'on' ? 0 : -53)+'px"
- 然后我可以看到IE浏览器的ON / OFF的背景图像上,但我只要按一下按钮,它再次消失。

这里是点击功能 -


jQuery(this).click(function() {

			if(state == 'on') {

				jQuery(this).find('.iphone_switch').animate({backgroundPosition: -53}, "slow", function() {

					jQuery(this).attr('src', settings.switch_off_container_path);

					switched_off_callback();

				});

				state = 'off';

			}

			else {

				jQuery(this).find('.iphone_switch').animate({backgroundPosition: 0}, "slow", function() {

					switched_on_callback();

				});

				jQuery(this).find('.iphone_switch').attr('src', settings.switch_on_container_path);

				state = 'on';

			}

		});		

 


有什么建议?

谢谢

回答

评论会员:{ 时间:2