[英]Jquery Image rotate and toggle are not working at a time in IE8 and IE9
要求是單擊圖像時應旋轉圖像,並隱藏下面的相應數據;再次單擊圖像時,應旋轉圖像並顯示相應的隱藏數據。
就像在Visual Studio 2010解決方案資源管理器中,當我們單擊“圖像”按鈕時,圖像正在旋轉,並且下面的相應數據處於隱藏狀態。
我的代碼對Google cromo和Mozilla正常工作。 但在IE8和IE9中無法正常工作。
我的插件
<script src="@Url.Content("~/Scripts/jQueryRotate.2.2.js")" type="text/javascript"> </script>
我的IE8代碼:
<!--[if IE 8]>
<script type="text/javascript">
var deg = 0;
$(document).ready(function () {
$('#imgId').click(function () {
deg = deg ? 0 : -90;
rotationDeg = 0;
switch (deg % 360) {
case 0:
rotationDeg=0;
break;
case -90:
rotationDeg=3;
break;
}
$('#divId').slideToggle("slow");
$("#imgId").css('filter', 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + rotationDeg + ')');
$('#divId').Toggle("slow");
});
});
</script>
<![endif]-->
上面的代碼工作正常,但是它顯示以下javaScript錯誤。
對象不支持屬性或方法“切換”
然后我將其更改為
$('#divId').toggle("slow");
現在,javaScript錯誤已解決,但是圖像旋轉和toggle
無法正常工作。 IE9也發生相同的問題。 誰能幫忙-我該如何解決?
嘗試這個:
<!--[if IE 8]>
<script type="text/javascript">
var deg = 0;
$(document).ready(function () {
$('#imgId').click(function () {
deg = deg ? 0 : -90;
rotationDeg=0;
switch(deg%360){
case 0:
rotationDeg=0;
break;
case -90:
rotationDeg=3;
break;
//<---------removed the '}' here
$('#divId').slideToggle("slow");
$("#imgId").css('filter','progid:DXImageTransform.Microsoft.BasicImage(rotation='+rotationDeg+')');
$('#divId').toggle("slow");
});
});
</script>
<![endif]-->
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.