2

I have used successfully over long time the below JavaScript function in my theme options page. It does save the WP Theme Options by JavaScript 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 JavaScript:

<!--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 :)

1 Answer 1

3

Try changing setTimeout("jQuery('#saveMessage').hide('slow');", 5000); to setTimeout(function() { jQuery('#saveMessage').hide('slow'); }, 5000);

7
  • this brought back the message! but still, i can not anymore change the "time set": If I do: setTimeout(function() { jQuery('#saveMessage').hide('slow'); }, 2000); the message shows up but does not disappear anymore. If I do: timeout: 2000 }); setTimeout(function() { jQuery('#saveMessage').hide('slow'); }, 5000); the message does not even appear Same if I do timeout: 2000 }); setTimeout(function() { jQuery('#saveMessage').hide('slow'); }, 2000); I could change it previously to 50000 to edit CSS with firefox console...) .. I am puzzled
    – user3934058
    Commented Apr 18, 2015 at 6:54
  • @beda69 So you are telling me the timeout only works when it's 5000?
    – Joseph
    Commented Apr 18, 2015 at 7:10
  • @beda69 Might sound stupid, but are you changing the 5000 in both places?
    – Joseph
    Commented Apr 18, 2015 at 7:11
  • i was previously able to just change it in first place (up to 50'000 to keep it long enough visible, so to edit in CSS editor) Now, if I change either both, only first, only second, no matters which, it works only if both values are set to 5000 and that was not so, previously, definitely :) I am developing since 3 months now. This happened after upload - download from git. I am very at end of latin :)
    – user3934058
    Commented Apr 18, 2015 at 7:14
  • my goal, actually, is to show the message ASAP and let it visible for perhaps 3 sec- max. previously, I could change whatever I wanted in timout: ... now, I can't change a thing !
    – user3934058
    Commented Apr 18, 2015 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.