Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未使用jQuery resize()调整div的大小 我正在使用jQuery和Foundation框架。它内置于Wordpress主题中,这就是为什么我必须使用“jQuery”而不是简写的$表示_Jquery_Wordpress_Dom_Resize - Fatal编程技术网

未使用jQuery resize()调整div的大小 我正在使用jQuery和Foundation框架。它内置于Wordpress主题中,这就是为什么我必须使用“jQuery”而不是简写的$表示

未使用jQuery resize()调整div的大小 我正在使用jQuery和Foundation框架。它内置于Wordpress主题中,这就是为什么我必须使用“jQuery”而不是简写的$表示,jquery,wordpress,dom,resize,Jquery,Wordpress,Dom,Resize,jQuery在加载页面时调整幻灯片的大小。但是,如果我调整浏览器窗口的大小,它将不会调整大小。我试过很多东西,但都没用。(边框框、单独的函数、不同的语法) 您可以将代码放入resize事件中,并在页面加载时触发它。您还可以使用IIF在代码中使用$。你当然应该尝试限制大小调整,但现在这很酷 // We can use $ inside here... (function($){ // When the document is ready this is called... $(funct

jQuery在加载页面时调整幻灯片的大小。但是,如果我调整浏览器窗口的大小,它将不会调整大小。我试过很多东西,但都没用。(边框框、单独的函数、不同的语法)


您可以将代码放入
resize
事件中,并在页面加载时触发它。您还可以使用IIF在代码中使用$。你当然应该尝试限制大小调整,但现在这很酷

// We can use $ inside here...
(function($){

  // When the document is ready this is called...
  $(function(){

    // We'll be using thise more than once!
    var $window = $(window);

    // Whenever a resize event occurs, do this...
    $window.on('resize', function(e){

      var width = $window.width(), 
          height = $window.height() - $('.top-bar').height();

      $('.slide').height(height).width(width);
      $('.slide4 > div > img').height(height*.5);

    // The "trigger" fakes the event on load...
    }).trigger('resize');


  })

})(jQuery); // You're passing jQuery to the IIF, so this is why you can use $ inside.
希望这有帮助

// We can use $ inside here...
(function($){

  // When the document is ready this is called...
  $(function(){

    // We'll be using thise more than once!
    var $window = $(window);

    // Whenever a resize event occurs, do this...
    $window.on('resize', function(e){

      var width = $window.width(), 
          height = $window.height() - $('.top-bar').height();

      $('.slide').height(height).width(width);
      $('.slide4 > div > img').height(height*.5);

    // The "trigger" fakes the event on load...
    }).trigger('resize');


  })

})(jQuery); // You're passing jQuery to the IIF, so this is why you can use $ inside.