2

I want to marquee some content divs with continues scrolling. I create a module then added the jQuery from this url: https://github.com/aamirafridi/jQuery. This code is working successfully in our local server but not in my Joomla site. My default.php is

<?php defined('_JEXEC') or die('Restricted Access'); $document = JFactory::getDocument(); $document->addStyleSheet('modules/mod_marquee/css/style.css'); $document->addScript('modules/mod_marquee/js/jquery-2.1.1.min.js'); $document->addScript('modules/mod_marquee/js/jquery.marquee.min.js'); $document->addScript('modules/mod_marquee/js/script.js');?> <div class="row-fluid"> <div class="span12"> <div class="row-fluid" data-duration='5000' data-gap='10' data-dupilcated='true'> <div class="row marquee"> <div class="span3" align="center">level 2 column and ger more variables</div> <div class="span3" align="center">level 2 column</div> <div class="span3" align="center">level 2 column</div> <div class="span3" align="center">level 2 column</div> </div> </div> </div> </div> 

My script.js is: enter image description here

0

1 Answer 1

2

First thing's first:

do not import an unofficial jQuery library forked by someone!

Now, when importing any script, you should always define the root of your site using JUri::root(). You should also use Joomla's JHtml method. So replace this:

$document->addStyleSheet('modules/mod_marquee/css/style.css'); $document->addScript('modules/mod_marquee/js/jquery-2.1.1.min.js'); $document->addScript('modules/mod_marquee/js/jquery.marquee.min.js'); $document->addScript('modules/mod_marquee/js/script.js'); 

with this:

JHtml::_('stylesheet', JUri::root() . 'modules/mod_marquee/css/style.css'); JHtml::_('script', 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'); JHtml::_('script', JUri::root() . 'modules/mod_marquee/js/jquery.marquee.min.js'); JHtml::_('script', JUri::root() . 'modules/mod_marquee/js/script.js'); 

I'm not sure which version of Joomla you're using by take a look at my answer on another question to import jQuery properly

As for you script, try using this at the beginning instead:

jQuery(window).on('load', function($) { 

else try using:

jQuery(document).ready(function($) { 
1
  • Thank you so much bro @lodder i follow your procedure i got the result.I simply add this jQuery(document).ready(function($) { in my script.js. Commented Jul 18, 2014 at 10:19

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.