0
Welcome Guest! Login
0 items Join Now

Javascript error when using Roksprocket in normal modul position

    • RalKam's Avatar
    • RalKam
    • Newbie
    • Posts: 4
    • Thanks: 0

    Javascript error when using Roksprocket in normal modul position

    Posted 9 years 6 months ago
    • Hi,

      im using Roksprocket with the "RokSprocket Features Layout" to build a picture slider on my homepage. As long as I include it the normal way, like calling it from an article with the "[module-xxx]" shortcode syntax, everything works well.
      Now I want to publish the same module not by the shortcode, but as a normal module in a normal template position (f.e. "footer"). When I publish it that way, the slider appears quite normally with the first picture and the titel etc. But the slider doesn´t work, which means it won´t scroll to the next content item, neither is it scrollable by the left/right navigation.
      At the same time I get with this configuration a javascript error:
      TypeError: RokSprocket.instances.slideshow is undefined    index.php:42

      When I open the source code of the page, you can see the reason:
      window.addEvent('domready', function(){
      	RokSprocket.instances.slideshow.attach(113, '{"animation":"crossfade","autoplay":"1","delay":"5"}');
      });
      
      if (typeof RokSprocket == 'undefined') RokSprocket = {};
      Object.merge(RokSprocket, {
      	SiteURL: 'https://www.test.com/site-new/',
      	CurrentURL: 'https://www.test.com/site-new/',
      	AjaxURL: 'https://www.test.com/site-new/index.php?option=com_roksprocket&task=ajax&format=raw&ItemId=127'
      });
      window.addEvent('domready', function(){
      		RokSprocket.instances.slideshow = new RokSprocket.Slideshow();
      });
      window.addEvent('domready', function(){
      	RokSprocket.instances.slideshow.attach(113, '{"animation":"crossfade","autoplay":"1","delay":"5"}');
      });

      He´s adding the slideshow object (Line 1-3) to an event before he creates the object, which follows a few lines underneath (Line 11- ...).

      When I switch to the working shortcode version the sourcecode reads:
      if (typeof RokSprocket == 'undefined') RokSprocket = {};
      Object.merge(RokSprocket, {
      	SiteURL: 'https://www.test.com/site-new/',
      	CurrentURL: 'https://www.test.com/site-new/',
      	AjaxURL: 'https://www.test.com/site-new/index.php?option=com_roksprocket&task=ajax&format=raw&ItemId=127'
      });
      window.addEvent('domready', function(){
      		RokSprocket.instances.slideshow = new RokSprocket.Slideshow();
      });
      window.addEvent('domready', function(){
      	RokSprocket.instances.slideshow.attach(113, '{"animation":"crossfade","autoplay":"1","delay":"5"}');
      });

      So here the first three lines calling the undefined object are missing and in line 7 the object gets first initialised with a "new RockSprocket.Slideshow()". This make the whole thing work. So why do this extra lines, which break the code, come in when I use Rocksprocket as a normal module. I´m using Rocksprocket 2.1.2 on Joomla 3.3.6.

      Thanks a lot in advance for your suggestions ....

      Ralph
    • Damir's Avatar
    • Damir
    • Preeminent Rocketeer
    • Posts: 22450
    • Thanks: 2679
    • Web Developer

    Re: Javascript error when using Roksprocket in normal modul position

    Posted 9 years 6 months ago
    • RalKam's Avatar
    • RalKam
    • Newbie
    • Posts: 4
    • Thanks: 0

    Re: Javascript error when using Roksprocket in normal modul position

    Posted 9 years 6 months ago
    • This message contains only secure information that is visible to Damir, moderators and administrators
    • Last Edit: 9 years 6 months ago by RalKam.
    • Damir's Avatar
    • Damir
    • Preeminent Rocketeer
    • Posts: 22450
    • Thanks: 2679
    • Web Developer

    Re: Javascript error when using Roksprocket in normal modul position

    Posted 9 years 6 months ago
    • RalKam's Avatar
    • RalKam
    • Newbie
    • Posts: 4
    • Thanks: 0

    Re: Javascript error when using Roksprocket in normal modul position

    Posted 9 years 6 months ago
    • Hi Damir,

      I already posted all data in the previous secure reply. The given data also works for the backend. The forum software says, you can read it ;-)

      Thx
      Ralph
    • Last Edit: 9 years 6 months ago by RalKam.
    • RalKam's Avatar
    • RalKam
    • Newbie
    • Posts: 4
    • Thanks: 0

    Re: Javascript error when using Roksprocket in normal modul position

    Posted 9 years 5 months ago
    • Hi Damir,

      I tried another thing which makes the module work. If I take a custom module (with plugins enabled) and write as content [module-xxx] in it, publish it in a normal module-position, then the whole thing also work. You can see it on the Web site under the menuitem "RokWork".

      thx
      Ralph
    • Damir's Avatar
    • Damir
    • Preeminent Rocketeer
    • Posts: 22450
    • Thanks: 2679
    • Web Developer

    Re: Javascript error when using Roksprocket in normal modul position

    Posted 9 years 5 months ago

Time to create page: 0.056 seconds