小编Ano*_*non的帖子

垂直对齐包含div中的绝对定位div

我正在使用jQuery Cycle插件以幻灯片方式旋转图像.这很好.我遇到的问题是将这些图像(不同大小)放在包含div的中心.这些图像位于一个slidshow div中,它的位置被Cycle插件设置为绝对位置.

我已经尝试过设置行高/垂直对齐等等但没有骰子.这是相关的HTML和CSS

HTML:

<div id="projects">
  <div class="gallery">
     <span class="span1">&#9668;</span><span class="span2">&#9658;</span>
        <div class="slideshow">
          <img src="images/img1.png"  />
          <img src="images/img1.png"  />
          <img src="images/img1.png"  />
        </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

#main #home-column-2 #projects
{
  width: 330px;
  background: #fefff5;
  height: 405px;
  padding: 12px;
}

#main #home-column-2 #projects .gallery
{
  width: 328px;
  height: 363px;
  position: relative;
  background: url('images/bg-home-gallery.jpg');
}

#main #home-column-2 #projects .gallery img
{
  position: relative;
  z-index: 10;
}
Run Code Online (Sandbox Code Playgroud)

如果你想看到它,jQuery:

$('#home-column-2 #projects .gallery .slideshow').cycle(
{
   fx: 'scrollHorz',
   timeout: 0,
   next: "#home-column-2 #projects .gallery span.span2", …
Run Code Online (Sandbox Code Playgroud)

html css image center

5
推荐指数
1
解决办法
1万
查看次数

jQuery CSS Hover

我有一个CSS菜单,用于设置悬停在它上面的父li的颜色和它的子ul(子菜单).基本上,当您将鼠标悬停在菜单上时,它会改变颜色并保持这种状态,直到您将菜单及其子菜单鼠标移开为止.看起来很好.

我添加了一些jQuery代码来改变菜单项的颜色,直到打开某个页面.然后,这些菜单将淡入并重新获得颜色.此时,等待悬停改变颜色.

我遇到的问题是,当您使用jQuery将颜色更改回原始状态(在CSS中设置)时,它会移除:hover类,以防止在将鼠标悬停在其上时的颜色更改及其子子菜单.有想法该怎么解决这个吗?是否有一个jQuery选择器允许我将:hover类设置回正常状态?

/* ---- Menu Colours ---- */
$(document).ready(function()
{
   var colours = ['d50091', 'c8fa00', '00b4ff', 'b158fc', 'ffa800', '00b72f'];
   var counter = 0; // Loop for the colurs
   var status  = 0; // Status of the colours (greyed out or visible)

   $('ul.menu-horiz').children('li').children('a').hover(function()
   {
      $(this).parent()[0].css('color', '#d50091');
   }, function()
   {
      $(this).parent()[0].css('color', '#b6b6b6');
   });

   $('ul.menu-horiz').children('li').children('a').each(function()
   {
      $(this).css({opacity: 0.2, color: '#' + colours[counter]});
      counter++;
   });

   $('.haccordion .header').click(function()
   {
      if (window.location.hash.substr(1) == 'photogallery')
      {
         $('ul.menu-horiz').children('li').children('a').each(function()
         {
            if ($(this).css('opacity') != '1.1')
            {
               $(this).animate({opacity: 1.1}, 1000).css('color', …
Run Code Online (Sandbox Code Playgroud)

javascript css jquery hover

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

css ×2

center ×1

hover ×1

html ×1

image ×1

javascript ×1

jquery ×1