SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2010
    Location
    Brighton, UK
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Performant Javascript

    I'm writing a map editor in Javascript and XHTML at the moment. It's based on a table, 100 x 100 cells and I'm executing code and adding listeners to each cell. I've been using JQuery which sometimes works really well and sometimes borks with a dead page message.

    Selectors are fine, hover works just great. hide(0) dies but css("display","none") works quickly. Surprisingly toggle completely fails.

    I was wondering if anyone has any experience with using Javascript like this and has any thoughts or tips. I'm not wedded to jquery and it would be nice to do some animation.

  2. #2
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rather than managing 10000 sets of handlers, I'd handle all the events from the table,
    and determine the target cell from there.

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2010
    Location
    Brighton, UK
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome, that's exactly the kind of thinking I like

    I was considering placing an absolutely positioned transparent div over the whole table and detecting clicks from that, using the mouse coords to set the hidden checkboxes. The advantage of that is that I could also use it to simulate environmental effects (fog, rain, etc) using semi-transparent pngs.


Bookmarks

Posting Permissions

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