javascript - Image Preview with jQuery, How to remove the a href click event -


this should not complicated:

i using easiest tooltip , image preview using jquery trying use example

how can disable click event on original picture, want tooltip displayed (i don't want allow click on picture)

how can done? thanks!

this current style:

<style> #preview{     position:absolute;     border:1px solid #ccc;     background:#333;     padding:5px;     display:none;     color:#fff;     } </style> 

this javascript:

this.imagepreview = function(){      /* config */          xoffset = 10;         yoffset = 30;          // these 2 variable determine popup's distance cursor         // might want adjust right result      /* end config */     $("a.preview").hover(function(e){         this.t = this.title;         this.title = "";             var c = (this.t != "") ? "<br/>" + this.t : "";         $("body").append("<p id='preview'><img src='"+ this.href +"' alt='image preview' />"+ c +"</p>");                                         $("#preview")             .css("top",(e.pagey - xoffset) + "px")             .css("left",(e.pagex + yoffset) + "px")             .fadein("fast");                             },     function(){         this.title = this.t;             $("#preview").remove();     });      $("a.preview").mousemove(function(e){         $("#preview")             .css("top",(e.pagey - xoffset) + "px")             .css("left",(e.pagex + yoffset) + "px");     });          };   // starting script on page load $(document).ready(function(){     imagepreview(); }); 

this main:

<a href="1.jpg" /*class="preview"*/><img src="1s.jpg" alt="gallery thumbnail" /></a> 

i use:

    $('.preview').click(function(e) {         e.preventdefault();         return false;     }); 

(if remove comment around class="preview")


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -