[jQuery] Re: Help needed to find image dimensions

2010-01-05 Thread devilmike
I believe John is correct on both counts. You can't get the image
dimensions before loading the image and the css method will work
unless you have to support versions of IE lower than 7.

 In any case this script should work. To prevent seeing the full size
image before it resizes, hide the preview image with css and then show
it at the end of the hover on function.

$(a.preview).hover(
function(){
 var imgSrc = this.title;
 $(body).append('p id=previewimg src='+ imgSrc + ' alt=Image
preview/p');
var preImg = $('#preview img');

  if (preImg.width()  preImg.height()){
  preImg.width(200)
  }
  else{
  preImg.height(200)
  }
 },
 function(){}
 )


Michael



On Jan 5, 3:11 am, John Arrowwood jarro...@gmail.com wrote:
 It would be wonderful if I am wrong, but I don't think you can get the image
 dimensions via JavaScript.  But you don't need to...

 style
 a.preview {
   max-width: 200px;
   max-height: 200px;}

 /style

 This will force the image to fit within a 200px by 200px window without
 altering the image aspect ratio.



 On Mon, Jan 4, 2010 at 6:51 AM, banacan banaca...@gmail.com wrote:
  I'm using Preview.js to create image previews on hover.  The script as
  it is now displays the full size image on hover, but that is often too
  big.  I have been able to reduce the preview size by defining
  width='200px' which works fine in many cases, but when the image is
  tall and narrow a 200px wide image my be 700px tall.  So what I'm
  trying to do is determine the image dimensions and if the width is
  greater than the height, set width='200px', otherwise set
  height='200px'.  I haven't been able to figure out how to get the
  image dimensions from the wrapped set.

  Here is an excerpt of my markup:

   a href=?php echo $mainImgDir . $mainImg;  ? class=preview
  title=?php echo $mainImg; ?img src=?php echo $thumbsDir . $image;
  ? alt=?php echo $image; ? class=center //a

  Here is an excerpt of my js code:

   $(a.preview).hover(function(e){
           this.t = this.title;
           this.title = ;
           var orientation = ((this.img[src]).width() 
  (this.img[src]).height()) ? ' alt='Image preview' width ='200px' / : '
  alt='Image preview' height='200px' /);
           var c = (this.t != ) ? br/ + this.t : ;
           $(body).append(p id='preview'img src='+ this.href +
   orientation + c +/p);

  Can anyone see what I'm doing wrong?

  TIA

 --
 John Arrowwood
 John (at) Irie (dash) Inc (dot) com
 John (at) Arrowwood Photography (dot) com
 John (at) Hanlons Razor (dot) com
 --http://www.irie-inc.com/http://arrowwood.blogspot.com/


[jQuery] Re: IDEs of jQuery

2009-11-20 Thread devilmike
I don't believe there is an ide with that level of support (yet), but
I haven't been looking lately. I'd checkout the link MorningZ
posted...


Michael



On Nov 19, 1:56 pm, Ankur_Patel ankurpate...@gmail.com wrote:
 to Michael, I am also use NetBeans but how can i get jQuery all library like
 php functions,properties

 On Thu, Nov 19, 2009 at 8:58 PM, devilmike devilm...@gmail.com wrote:
  This isn't specifically for jQuery, but NetBeans handles it extremely
  well. I use the Early Access for PHP version.

  Michael

  On Nov 19, 4:13 am, Ankur_Patel ankurpate...@gmail.com wrote:
   Can any one tell me name of jQuery IDEs... like dreamweaver use of IDE as
   HTML,PHP,ASP,XML,CSS

   Any IDE there for jQuery code so we can write codes easy  fast

   Thanx


[jQuery] Re: IDEs of jQuery

2009-11-19 Thread devilmike
This isn't specifically for jQuery, but NetBeans handles it extremely
well. I use the Early Access for PHP version.

Michael



On Nov 19, 4:13 am, Ankur_Patel ankurpate...@gmail.com wrote:
 Can any one tell me name of jQuery IDEs... like dreamweaver use of IDE as
 HTML,PHP,ASP,XML,CSS

 Any IDE there for jQuery code so we can write codes easy  fast

 Thanx


[jQuery] Re: change certain elements in result set based on position

2009-01-23 Thread devilmike

Awesome Ricardo, thanks! I guess the only issue I have is that I'll
never know how many sets of 4 I'll be dealing with, and i apologize
for not explaining myself very well in my example. Basically for each
set, I want to run the same function.  This is what I came up with.
It works, but I'm a bit concerned about the amount of looping going
on. Your code seems much cleaner...


var result = $('a');
var theCount = 4; //variable passed in
var oldCount = -1;
var theRow = result;

while (theRow.length  1){
theRow = jQuery.grep(result, function(n, i){
return (n   i  theCount  i  oldCount );
});
oldCount = theCount - 1;
theCount = theCount + 4;

$(theRow).each(function(i, o){
// do something to each item of each set
});
}


[jQuery] change certain elements in result set based on position

2009-01-22 Thread devilmike

Hello all,

I can't quite get my head around how to accomplish this and any
guidance would be greatly appreciated.

Say I have some random number of h1's on the page, like 20. I'd like
to grab the first 4 and make them red, then grab the next 4 and make
them blue, then grab the next 4 and do something else with them, and
so on until I reach the end.

I've been looking at .each() and some of the array functions, but I
can't seem to piece it together.

Thanks,
Michael


[jQuery] Re: jQuery Cycle - remove slide

2008-11-06 Thread devilmike

Thanks Mike. Great plugin btw.


 Not without stopping first and restarting afterwards.