Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.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/5/sql/87.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在悬停更改照片上单击显示说明_Jquery_Html_Css - Fatal编程技术网

jquery在悬停更改照片上单击显示说明

jquery在悬停更改照片上单击显示说明,jquery,html,css,Jquery,Html,Css,我有两个div。我想在悬停改变照片,点击显示说明,并作出反应 如有任何帮助或建议,将不胜感激 要更改背景,可以使用jquery的hove/css功能: $(document).ready(function() { $("your div/id").hover(function() { $("your div/id").css("background-image", "url(/myimage.jpg)"); }); }); 要执行网站的“单击”部分,您可以

我有两个div。我想在悬停改变照片,点击显示说明,并作出反应

如有任何帮助或建议,将不胜感激


要更改背景,可以使用jquery的hove/css功能:

 $(document).ready(function() {
       $("your div/id").hover(function() {
           $("your div/id").css("background-image", "url(/myimage.jpg)");
});
});
要执行网站的“单击”部分,您可以使用“单击”功能:

 $(document).ready(function() {
   $(" your div/id").click(function() {
       // I need more info to explain this one.
   });
  });

您可以发布一些代码,让我看看您是如何编写代码的,我可以更改我的答案。

如果您想在悬停状态下切换图像,请执行以下操作:

$('a').hover(function() {
  $('.image').css({
    backgroundImage: 'url(http://placehold.it/1024x768)'
  })
}, function() {
  $('.image').css({
    backgroundImage: ''
  })
});
$('a').on('click', function(){
  $('.menu').hide();
  $('.form').show();
});
单击以下内容:

$('a').hover(function() {
  $('.image').css({
    backgroundImage: 'url(http://placehold.it/1024x768)'
  })
}, function() {
  $('.image').css({
    backgroundImage: ''
  })
});
$('a').on('click', function(){
  $('.menu').hide();
  $('.form').show();
});
这是完整的测试

这可以帮助你开始。添加样式并根据需要进行修改


例如,如果您想为每个链接添加不同的图像,请向它们添加类,并分别以它们为目标,等等。

您的代码在哪里?请提供一份报告。