Javascript error on page controls

Permalink
Hi All

I'm trying to add a jquery slider to a responsive theme I've built, the plugin works fine apart from the fact its stripping out the page controls in edit mode. I'm guessing its a conflict between the jquery on the page and the internal ui. The errors I get are

Uncaught TypeError: Cannot read property 'widget' of undefined ccm.app.js:3
Uncaught TypeError: Property '$' of object [object Object] is not a function page_controls_menu_js:65
GET http://79.170.44.138/woodrowmercer.com/themes/WoodrowTheme/img/navselect.gif 404 (Not Found) /woodrowmercer.com/themes/WoodrowTheme/img/navselect.gif:1



The siteshttp://79.170.44.138/woodrowmercer.com/... and you only get one error when not logged in! Its a little bit beyond my jquery skillset to be honest... any help in solving this would be muchly appreciated.

Matteld80
View Replies:
webpresso replied on at Permalink Reply
webpresso
Hi
Try this in your view.php:
<?php
$u = new User();
//disable in edit mode
if ($u->isLoggedIn()) {
   echo t('<div class="edit_disable"><h4 >Slider in edit mode.</h4></div>');
}
else{
 ?>
YOUR CODE
<?php } ?>
Matteld80 replied on at Permalink Reply
Matteld80
Hi innotix

Thanks for the reply? Which view file do I try this on? So many view files in concrete5! :)
webpresso replied on at Permalink Reply
webpresso
Hi

In your Slider-Plugin you've built. You may not show your javascript in the Edit-Mode.
path: packages/YOURSLIDERPLUGIN/block/yourslider/view.php
example of my bootstrap slider
<?php 
if ($u->isLoggedIn ()) { ?>
<!-- do nothing -->
<?php } else { ?>
<script type="text/javascript">
$(document).ready(function() {
   //JQUERY PLUGIN EXAMPLE:
   $('#gallery<?php echo $bID ?>').carousel({
      interval: 3000 });
});
</script>   
<?php }?>