5

jcarousel plugin is working when we run the page on browser but if we run the same page in sitecore preview mode(In sitecore: Click on Presentation in the top menu. Click on Preview in the ribbon) then this plugin is not working. please let me know if you have solution that would be helpful.

Martin Davies
  • 4,436
  • 3
  • 19
  • 40
Gaurav Agarwal
  • 863
  • 7
  • 28

1 Answers1

3

Which version of Sitecore do you use? I think the problem might be with jquery conflicting with prototype.

You can try to use jquery in noConflict mode:

var $j = jQuery.noConflict();

In nutshell, add this line before the place you initialize your jcarousel, e.g.:

var $j = jQuery.noConflict(); // switch jquery to noconflict mode

$j('.jcarousel').jcarousel(); // this is your initalization of jcarousel

More explanation in jquery conflicts with pageeditor article

Marek Musielak
  • 26,832
  • 8
  • 72
  • 80
  • where should we declare this variable on 1 page or in plugin? And we are using sitecore 6.6 – Gaurav Agarwal Dec 19 '13 at 11:44
  • 1
    Personally, I prefer anonymous functions and isolating scope. Allows you to continue using $ in all your code. http://blog.navigationarts.com/avoiding-jquerys-noconflict-mode-with-prototype-and-sitecore/ But same difference. – jammykam Dec 19 '13 at 15:25
  • @jammykam brilliant idea! Haven't seen that before – Marek Musielak Dec 19 '13 at 15:36