Hello (CF) jQuerians,

 

I currently have a working code but I would really like to improve and make
it more efficient. Your suggestions will be great.

Right now, I have a jquery script inside a loop (cfloop). The jquery is a
just simple tooltip-like functionality, that shows and hides a thumbnail
image on a text description hover. The image is loaded from a cfquery id
variable assigned into a div id.  What I'd like is to remove the jquery
script outside of the cfloop, so it does not redundantly iterate when the
page runs. The simplified code is as follows:

 

<cfloop query="myQuery">

            <a id="aid#myQuery.id#"
href="somepage.cfm?to=#myquery.id#">#myQuery.text#</a>

 

            <div id="imgid#myQuery.id#"><img
src="/thumbnails/#myQuery.image#" /></div>

            <script type="text/javascript">

                      $("##imgid#myQuery.id#").hide(); 

                      $(function(){ 

                            $("##aid#myQuery.id#").hover(function(){ 

                            $("##imgid#myQuery.id#").show(); 

                         },function(){ 

                            $("##imgid#myQuery.id#").hide(); 

                          });       

                       });

             </script>

</cfloop>

 

If the answer seems too obvious for you, then I must say that its been a
long week for me. I just need a brain boost from someone.. :-)

 

Thank you very much in advance, for your suggestions.

 

Michael

 

 

 

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to