www.webdeveloper.com
Results 1 to 3 of 3

Thread: Have to click 2 times to trigger event

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Location
    Berlin
    Posts
    97

    Have to click 2 times to trigger event

    The "helptag" (the red label on the left of the page) on this website has to be clicked twice to see its content (it slides to the right). After the second click it makes a weird jump which it shouldn't. Visit the link to see what happens.

    This is the JS:
    Code:
    <script type="text/javascript">
    var i=-130
    var c=0
    var intHide
    var speed=3
    function show_hide_menu()
    {
    if (c==0)
    {
    c=1
    clearInterval(intHide)
    intShow=setInterval("show()",10)
    }
    else
    {
    c=0
    clearInterval(intShow)
    intHide=setInterval("hide()",10)
    }
    }
    function show()
    {
    if (i<-10)
    {
    i=i+speed
    document.getElementById('helptag').style.left=i
    }
    }
    function hide()
    {
    if (i>-130)
    {
    i=i-speed
    document.getElementById('helptag').style.left=i
    }
    }
    </script>
    It's triggered by
    Code:
    <div id="helptag" style="position:fixed" onclick="show_hide_menu()">
      <div align="right" class="alphabettxt">
        <div align="right">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="200" class="helptagtxt hyphenate">Hello there! Check <a href="#footer">the footer</a> for more info.</td>
              <td><div align="right"><span class="labeltxt">❤<sup>3</sup></span></div></td>
            </tr>
          </table>
        </div>
      </div>
    </div>
    Any help would be appreciated.

  2. #2
    Join Date
    Aug 2010
    Location
    Ohio
    Posts
    32
    EDIT: My response didn't make sense... I will draft up another after lunch.
    Last edited by drudeken; 08-22-2010 at 02:14 PM. Reason: Just plain wrong.

  3. #3
    Join Date
    Feb 2010
    Location
    Berlin
    Posts
    97
    Thanks in advance drudeken.

    I forgot to mention that the problem ceases to exist after adding a doctype, but that caused other problems. It's a while ago I worked on this project, don't remember what exactly the issues were…

    EDIT It might have something to do with something not working in Firefox after adding a doctype. Curse my bad memory!
    Last edited by Pris; 08-22-2010 at 04:27 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles