Forums / General / crazy "21" template problem

crazy "21" template problem

Author Message

cloud stone

Friday 04 February 2011 5:03:29 am

hello, we have a crazy problem with for loop.

in general we work with a template which build an video gallery.

we use jq tooltip to dynamically display video content.

whatever, everything works fine if the quantity of video items that we create in this "for loop" is < 21.

if the quantity is >=21 the qj tooltip don't work as expected.

the error:

as you se we override the jq tooltip event "mouseenter, mouseleave" to " click, "" "

this works as expected if our loop is < 21. if its >20 the mouseenter event comes back and we get a crazy mixture of both events.

example code without video content. the example is reduced to the minimal code structure to reproduce our error.

{def $cols=5
     $rows=8
     $video_count=21
     $field_count=40
     $random_field_nrs=ssl_randomlist(0,$field_count|sub(1),$video_count)}

<div class="videoarea">

  {def $video_index=0}
  {for 0 to $field_count|sub(1) as $index}
    {if and(lt($video_index, $video_count),
            $random_field_nrs|contains($index))}

      <div class="video">
       previewimage
      </div>
      <div class="tooltip">
           video {$index}
      </div>

      {set $video_index = $video_index|inc()}
      {continue}
    {/if}

  {/for}
  {undef}
  <div class="clear"></div>
</div>

{literal}
  <script type="text/javascript">
    $jq(document).ready(function() {
      $jq(".video").tooltip({
        effect: 'slide',
        events: { def: 'click, ',
                  tooltip: 'mouseover'
                }
      });
    });
  </script>
{/literal}

greetings

André R.

Friday 04 February 2011 6:14:26 am

So it's a jq issue? Then what is jq? jQuery? fork of jQuery?
Anyway, if it is jq issue, then this is not the place to post question about it.

If not then you should probably leave jq out of it if you want answears, simply:
What html output do you expect from the code and what do you get?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

cloud stone

Sunday 06 February 2011 8:56:51 am

i wrote "jq" as an abbreviation for jQuery ( javascript library at http://jquery.com ). sorry if it produce ambiguity.

i am not so familiar with javascript, ezPublish templates and so on. web technologies in general are new land for me.

whatever, i will move this question to the jQuery forum. but if somebody here know a similar effect- or understand my question- or find a problem/error in my code. i am very happy about tips or suggestions.

------------------------

EDIT 2.11.2011:

SOLVED! it was a simple jQwery problem.