Disabling jscript etc. elements when editing page.

Permalink
Hi,

I have understanded that it is possible to show certain elements in theme file when editing and hide them from end-user.

Does this work another way around?

I have theme that uses Jquery for image-carousel. Images are inside list elements and each list has specific class. This class is used to call Jquery script and magic happens.

so, i would like to disable loading of specific javascript on theme file when admin is looking site in editing mode (so i could easily add more images to list element). Is this possible (i somehow feel it is).

Thanks in advance.

anttivaatainen
 
anttivaatainen replied on at Permalink Reply
anttivaatainen
...just figured out that it might work with php if else, so something like this:
<?php if ($c->isEditMode()) { ?>  <?php } else { ?> <script type="text/javascript">and here goes my image-carousel;</script> <?php } ?>

thanks for villekervinen for helping with php.

unluckily im not at work comp at the moment so icannot verify it works, but tomorrow i should have change. Anyways if someone has information about this right in pocket, feel free to share your thoughts.