vendredi 17 avril 2015

Java Script is acting suddenly unexpected

I have used successfully over long time the below JS function in my theme options page. It does save the WP Theme Options by JS and puts a message on my screen once saved.


Suddenly, if I change the timeout settings (value) the message does either not show at all, or does show but does not hide anymore.


This is my JS:



<!--Include AJAX save message + styles-->
<div id="saveResult"></div>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#myOptionsForm').submit(function() {
jQuery(this).ajaxSubmit({
success: function(){
jQuery('#saveResult').html("<div id='saveMessage'class='successModal'></div>");
jQuery('#saveMessage').append("<p><?php echo htmlentities(__('Settings Saved Successfully','wp'),ENT_QUOTES); ?></p>").show();
},
timeout: 5000
});
setTimeout("jQuery('#saveMessage').hide('slow');", 5000);
return false;
});
});
</script>


This is the according CSS:



.successModal {
display: block;
position: fixed;
top: 35%;
left: 20%;
border-radius: 50% !important;;
width: 123px;
height: 153px;
padding: 5px 20px;
background-image: url("Smile-success.png");
z-index:1002;
overflow: auto;
background-position: center center;
background-repeat: no-repeat;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
-moz-box-shadow: 5px 5px 10px #cfcfcf;
-webkit-box-shadow: 5px 5px 10px #cfcfcf;
}


This all worked very good until I uploaded the entire theme to github, and then back down to my Computer.


Since then, not even a MAC Time Capsule Backup solves the problem.


The problem, if I change the timeout: 5000 to (which before was possible) timeout: 2000 or any other value, the message des not disappear any more and takes very long to show up.


Does any body have a idea what this could be?


I tried even a scratch version of options page.


What can be the issue for it stop work all of a sudden, even browser crossing?


I tried also MAMP Restar, fresh folders, fresh instal...


I really hope somebody can help me put here :)


Aucun commentaire:

Enregistrer un commentaire