We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1921
    • 32 Posts
    Hi,

    I’ve got a site up and running that I’d like to use the ticker widget for. The problem is that when the page first loads, the text goes out of the content area I want it in. You can see it happen here. At the top left, it loads "Test 1" and then "Test 2" just below it. Seconds later the ticker runs properly as planned. Is there any way to get the ticker to load without displaying the text before it’s ready to run? Or is there another work around so it doesn’t look so crapy before the TV runs? I know I’ve got a lot of javascript running on the site which could be causing slow load times, but those other scripts take preceidence over the ticker widget. Any ideas?

    Thanks.
      • 21257 MODX Staff
      • 730 Posts
      I might try keeping that element hidden until the ticker is ready...
      Current code:
      <div id="tvtvsmheader">
          <div class="mooticker">Test 1</div>
          <div class="mooticker">Test 2</div>
      </div>
      <script type="text/javascript">
      	window.addEvent('domready', function(){
      		var modxTicker = new MooTicker($("tvtvsmheader"),{
      			width: '300px',
      			height: '25px',
      			interval: 4000
      		});
      	});
      </script>
      


      Changed to:
      <div id="tvtvsmheader" style="display:none;">
          <div class="mooticker">Test 1</div>
          <div class="mooticker">Test 2</div>
      </div>
      <script type="text/javascript">
      	window.addEvent('domready', function(){
      		document.getElementById('tvtvsmheader').style.display='block';
      		var modxTicker = new MooTicker($("tvtvsmheader"),{
      			width: '300px',
      			height: '25px',
      			interval: 4000
      		});
      	});
      </script>
      


      And I might be tempted to play around with putting some of the javascript down at the bottom of the page - it might just make the page loading a little smoother - might not too ;-) At half a meg, these things are really noticable over dialup! (Did I just admit that?)
        Mike Schell
        Lead Developer, MODX Cloud
        Email: [email protected]
        GitHub: https://github.com/netProphET/
        Twitter: @mkschell
        • 1921
        • 32 Posts
        Hey, thanks so much! I figured it was something really simple that I just couldn’t find. This would be really useful if it were already integrated into Modx. I’m not sure if anyone else has this problem, but it seems to me that this is the default way it should load.

        I played around a little with the location of javascript, but didn’t notice too much of a difference. And, no, that page was only a test page with a test template wink