下面给出的javascript和jquery函数在MAC Safari中不起作用,但在所有其他设备和浏览器中都起作用

时间:2019-02-25 13:27:08

标签: javascript jquery html css

var slideInd = 1;
showDiv(slideInd);

function plusDiv(m) {
  showDiv(slideInd += m);
}

function currentDivs(m) {
  showDiv(slideInd = m);
}

function showDiv(m) {
  var j;
  var y = document.getElementsByClassName("mySlides");
  if (m > y.length) {
    document.getElementById('out').innerHTML = '1' + ' of 3';
  } else if (m < 1) {
    document.getElementById('out').innerHTML = y.length + ' of 3';
  } else if (m >= 1) {
    document.getElementById('out').innerHTML = slideInd + ' of 3';
  }

  if (m > y.length) {
    slideInd = 1
  }
  if (m < 1) {
    slideInd = y.length
  }
  for (j = 0; j < y.length; j++) {
    y[j].style.display = "none";
  }
  y[slideInd - 1].style.display = "block";
}
<div class="mySlides">
<img class="animation-element slide-down-3 img-responsive" src="https://cdn.msisurfaces.com/images/lookbook/invincibles/car3/gris-antoni-porcelain.jpg">
</div>
<div class="mySlides">
<img class="animation-element slide-down-1 img-responsive" src="https://cdn.msisurfaces.com/images/lookbook/invincibles/car3/cafe-antoni-porcelain.jpg">
</div>
<div class="mySlides">
<img class="animation-element slide-down-1 img-responsive" src="https://cdn.msisurfaces.com/images/lookbook/invincibles/car6/prescott-katella-ash-vinyl-flooring.jpg">
</div>

<div id="arrow1" class="arrow-rgt">

<a class="" onclick="plusDiv(-1)"><img class="img-responsive arrow-left" src="https://cdn.msisurfaces.com/images/lookbook/arrow-left-half.png"></a>

<span class="arrow-span" id="out"></span>

<a class="" onclick="plusDiv(1)"><img class="img-responsive arrow-right" src="https://cdn.msisurfaces.com/images/lookbook/arrow-right-half.png"></a>
			</div>	

鉴于javascript功能在所有浏览器和所有设备中均能正常工作,但在Mac safari浏览器中除外 但是,如果我打开检查元素是野生动物园浏览器,那么如果我关闭检查元素选项卡,则此功能可以正常工作

请帮助我

span标签上方仅在macbook safari中不起作用

0 个答案:

没有答案