模态关闭而不重新加载页面

时间:2016-07-26 10:37:40

标签: javascript html css salesforce

在此模态视图中,当我点击标签弹出窗口打开但是当我点击关闭时,Url会使用URL强制编码,例如 www.example.com /#,并且模态将被关闭。如果发生这种情况,一旦模态关闭,用户就无法点击任何其他链接。    的CSS:

#target-content1 {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
   pointer-events: none;

  opacity: 0;
  -webkit-transition: opacity 200ms;
  transition: opacity 200ms;
}


#target-content1:target {
  pointer-events: all;
  opacity: 1;
}

#target-content1 #target-inner {
  position: absolute;
  display: block;
  padding: 48px;
  line-height: 1.8;
  width: 70%;
  top: 50%;
  left: 50%;
  -webkit-transform: translateX(-50%) translateY(-50%);
  -ms-transform: translateX(-50%) translateY(-50%);
  transform: translateX(-50%) translateY(-50%);
  box-shadow: 0px 12px 24px rgba(0, 0, 0, 0.2);
  background: white;
  color: #34495E;
}

#target-content1 #target-inner h2 { margin-top: 0; }

#target-content1 #target-inner code { font-weight: bold; }

#target-content1 a.close {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: #34495E;
  opacity: 0.5;
  -webkit-transition: opacity 200ms;
  transition: opacity 200ms;
}

#target-content1 a.close:hover { opacity: 0.4; }

我的Javascript

<script>

function closeModal() {
alert('sdcloseModal');

  document.getElementById("target-content1").style.opacity=0;
 }
function opencaseform() {
  alert('sd');
  document.getElementById("target-content1").style.opacity=100;
  document.getElementById("target-content1").style.pointerEvents="auto";
}
</script>

HTML

<img onclick="opencaseform()" src="http://www.123.com/images/f4.png"/></td>
<apex:commandButton style="padding: 5px;border-radius: 10px; font-size: medium;" value="{!$Label.cancel}" rerender="false"  onclick="closeModal();" />

0 个答案:

没有答案