link_on_hover

NAML documentation   Watch a video
   Usages of this macro
... in app.naml
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
<macro name="link_on_hover" parameters="id,href,text">
    <n.put_in_head
Binary
Namespace: HtmlNamespace
Parameters: in_head
.>
        <script type="text/javascript">
<![CDATA[
            function createMouseTrick(nodeid) {
                $(document).ready(function() {
                    var $text = $('#hover-text'+nodeid);
                    var $link = $('#hover-link'+nodeid);
                    var entered = false;
                    var count = 0;
                    $text.mouseover(function() {
                        $(this).hide();
                        $link.show();
                        checkMouse();
                    });
 
                    $link.mouseover(function() {
                        entered = true;
                    });
 
                    $link.mouseout(function() {
                        $link.hide();
                        $text.show();
                        count = 0;
                        entered = false;
                    });
 
                    function checkMouse() {
                        if (!entered) {
                            count++;
                            if (count < 5) {
                                setTimeout(checkMouse, 100);
                            } else {
                                $link.hide();
                                $text.show();
                                count = 0;
                                entered = false;
                            }
                        }
                    }
                });
            };
]]>
        </script>
    </n.put_in_head.>
    <span id="hover-text[n.id/]"><n.text/></span>
    <script type="text/javascript">
        document.write('<a id="hover-link[n.id/]" href="[n.href/]" style="display:none">');
        document.write('<n.javascript_string_encode
Binary
Namespace: NabbleNamespace
Parameters: text
.get_app_node
Binary
Namespace: NodeNamespace
Parameters: do
.text/>');
        document.write('</a>');
        createMouseTrick(<n.id/>);
    </script>
</macro>