Using Javascript

Summary

  • In case of clash of custom javascript code with Sitecake editor, detect edit mode with sitecakeGlobals.editMode boolean and turn your script off

Example

It happens that some specific javascript you want to use can clash with Sitecake in edit mode. Solution is to exclude that script in edit mode. There is a boolean sitecakeGlobals.editMode that you can use for edit mode detection.

Put this script in the header of your page:

<script type="text/javascript">
  $(function() {
    if ( !window.sitecakeGlobals || sitecakeGlobals.editMode !== true ) {
      $.getScript('js/yourscript.js');
    }
  });
</script>