English 中文(简体)
j Query - Variable compar that Just don t work
原标题:jQuery — Variable comparison that just doesn t work

EDIT: I ve put this in a document ready function. The images are big though, does document ready comply with large images? you can see it not working here: http://syndex.me

这正在使我ane。

var maxxxHeight = $(window).height();

$(".theImage").children( img ).each(function() {
  myHeight = $(this).height();
      if ( myHeight > maxxxHeight ){
      $(this).next().text("Browser " + maxxxHeight + " image height " + myHeight);
  };
});

出于某种原因,

a. 身体检查; 他不会 any。 图像的规模更大,有些则没有。 这些图像并非由安保部绘制。 他们的宽度和高度在任何时候都没有具体规定。

如何做到这一点? 这是一个完全不明确的问题,但是,如果是 s; /”以前是100万次。

增 编

最佳回答

我可以想到可能发生这种情况的几个原因。

  1. The images may not yet be completely loaded at the time the code runs.
  2. Your images may not be direct children of the element matching your class.
  3. Your code may be running before the document is loaded and nothing matches the class yet.

My best guess is (1), in which case you should add a load handler for the images that does what you want when the image completes loading. Running the code on both document load and image load is probably in order in case the image is cached and the load event for it fires before the image load handler is applied. Image load would be necessary if the image is replaced dynamically after the document has been loaded.

www.un.org/Depts/DGACM/index_spanish.htm 你们应当在当地对我的行程进行勘测,以避免对全球名称空间进行污染(以及由于范围问题而可能造成的ug)。

$(document).load( function() {
    var maxxxHeight = $(window).height();

    $(".theImage").children( img ).each(function() {
        $(this).load( function() { // only if images can be loaded dynamically
            handleImageLoad(this);
        });
        handleImageLoad(this);
    });

    function handleImageLoad(img)
    {
        var $img = $(img),  // declare local and cache jQuery for the argument
            myHeight = $img.height();
        if ( myHeight > maxxxHeight ){
           // this is where your real code would go to make adjustments, etc.
           $img.next().text("Browser " + maxxxHeight + " image height " + myHeight);
        };
    }
});
问题回答

你们需要做一些 de。 由于比较失败,检查了高射线和最高米的数值。 通过向青少年印刷。 我保证说,其中一人不是数人。 事实上,人们可能没有定义。

你们是否将贵格文法列入$(document)ready()。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签