Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You aren't missing anything. Currently, the runtime, specifically the <code>watch()</code> action uses, <code>.live()</code> to register event handlers. <code>sidetab()</code> eats all event handlers attached with <code>.live()</code>. <code>sidetab()</code> eats them because <code>.live()</code> actually works by attaching your click handler to the <code>document</code> object, and then watches for the event to bubble up. When it reaches the <code>document</code>, it checks to see if the event was registered from the element(s) matching your selector, if so, it fires your handler. <code>sidetab()</code> kills this by calling <code>event.stopPropagation()</code>, which stops the bubbling of the event, so it never reaches the <code>document</code>, so your handler will never fire. </p> <p>You can fix this by registering your event handler with the jQuery utility function, <code>.bind()</code>. <code>.bind()</code> will only register the handler for elements that already exist, but as long as you take care that the elements inside of your sidetab exist <strong><em>before</em></strong> you call <code>.bind()</code>, you will be fine. </p> <p>Something like this:</p> <pre><code>$K("#tester").bind("click", function() { $K(this).effect("bounce", { "times" : 3 }, 300); }); </code></pre> <p>Let's put that in the context of an entire app, shall we?</p> <p>To keep this example simple, we'll simply <code>emit</code> the javascript necessary to attach our handler and have the div bounce when clicked. This example is also <a href="https://gist.github.com/720710" rel="nofollow">available as a gist</a>:</p> <pre><code>ruleset a369x111 { meta { name "Sidetab-&gt;Events" description &lt;&lt; Sidetab jQuery &gt;&gt; author "AKO" logging on use javascript resource jquery_ui_js } global { css &lt;&lt; #tester { margin-left: 10px; margin-top: 10px; width: 80px; height: 80px; background: green; position: relative; } &gt;&gt;; } rule tab { select when pageview ".*" pre { results = &lt;&lt; &lt;div id="tester"&gt;&lt;/div&gt; &gt;&gt;; } { sidetab() with pathToTabImage = "http://dl.dropbox.com/u/10762217/search-tab-images/tab2.png" and tabColor = "transparent" and topPos = "50px" and message = results and divCSS = { "z-index": 10000, "backgroundColor": "#ffffff", "width": "200px", "padding": "0px", "imageHeight": "162px", "imageWidth": "53px", "-moz-border-radius": "5px" }; emit &lt;| $K("#tester").bind("click", function() { $K(this).effect("bounce", { "times" : 3 }, 300); }); |&gt;; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload