When disable Java i can't edit anything

Permalink
Hi.

I am using this code to disable a javascript slide show when in edit mode.
It's looping some images and i don't want that functions turnd on when in edit mode.

<?php
global $c;
if(!$c->isEditMode()){
?>
<script src="<?php echo $this->getThemePath()?>/js/responsiveslides.min.js"></script>
<?php }?>

When i apply the code above i wont be able to click any of the content box/buttuns. Simply nothing happens when i click them.

If i just load it like all the other scripts like so:
<script src="<?php echo $this->getThemePath()?>/js/responsiveslides.min.js"></script>

I can edit my content but then i can't catch the content box thats keep looping.

Can someone help me?

 
cubewebsites replied on at Permalink Best Answer Reply
Are you sure this is the script causing issue?

From your code it looks like your trying to remove the plugin but not the plugin initialisation code i.e when you remove the plugin using !$c->isEditMode, you're removing the plugin which some part of your code is later trying to use.

Have a look at the "Console" in Chrome, or in Firebug for Firefox to see what the JavaScript error is which should make it easier to find which file is trying to run the responsive slider. You might see something like this:

$(<SOME_SELECTOR>).responsiveSlides(); is not a function.

Locate where the .responsiveSlides() function is being called from and put your if statement around that
Highlight replied on at Permalink Reply
Of course :) Now it works.. Nice job! Thank you very much!!