????
Current Path : /home2/morganrand/backup.morganrand.com/0tools/js/ |
Current File : /home2/morganrand/backup.morganrand.com/0tools/js/qtip2image.js |
var imgUrl = "http://c487397.r97.cf2.rackcdn.com/wp-content/uploads/2011/09/TallCat.jpg"; var idx=1; var imageObject = $('<img/>').load(function(){ var w = this.width; var h = this.height; var orgSize = {width:w,height:h}; var imgId = "thumb_"+idx; var actualImage = $('<img/>') .attr("id",imgId) .attr("src",imgUrl) .addClass("thumb") .data("orgSize",orgSize); // set EITHER width OR height if either is > 150 if (w<h && w>150) actualImage.attr("width",150); else if (w>h && h > 150) actualImage.attr("height",150); $('.qTip2Image').append(actualImage); }).attr("src",imgUrl); var cont_left; $("img.thumb") .live("mouseenter",function() { // save this scaled down image size for later $(this).data("newSize",{width:this.width,height:this.height}) $(this).animate({ width: $(this).data("orgSize").width, height: $(this).data("orgSize").height, left: "-=50", top: "-=50" }, "fast"); }) .live("mouseleave",function() { $(this).animate({ width: $(this).data("newSize").width, height: $(this).data("newSize").height, left: "+=50", top: "+=50" }, "fast"); });