English 中文(简体)
j 优质图像转换
原标题:jQuery animated image swap

Howdy. 这再次给我带来创伤。

http://misiur.com/small/“rel=“nofollow noreferer”

当有人点击左边的这个菜单时,我想改变这种形象的rc锁,或仅仅 s掉。 然而,我要说一下。 图像途径来自非行,并储存在“images”阵列(你可以用火力检查)。

感谢

最新情况:

传真:+PHP:

<div id="content_menu">
<ul>
<?php 
$q = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."prodcat");                                  $c = 1;                                     $id = 1;
foreach($q as $q)   
{
echo  <li class="ml .$c. ">
<a id="e .$id. " href="cat/ .$q->id. "> .$q->name. </a>
<img src="images/split.png" alt="" />
</li> ;
$id++;
$c++;
if($c == 8)
{
    $c = 1;
}
}
</ul>
</div>
<div id="product_display">
      <div id="product">
                <img id="changer" src="images/ex.jpg" style="background-image: url( images/products/cat/2.png );" alt="Przykład" />
                <div id="pmore"><a href="#">Więcej</a></div>
      </div>
</div>

JS:

<script type="text/javascript">
$(window).bind( load , function ()
{
var images = new Array();
<?php 
$q = $wpdb->get_results("SELECT id, image FROM ".$wpdb->prefix."prodcat");
foreach($q as $q)
{
echo "images[".($q->id-1)."] =  images/products/cat/".$q->image." ;
";
}
?>
$( #content_menu a ).click(function(e){
e.preventDefault(); 
var id = this.id.substr(1) % 7;
var i = this.id.substr(1);
$( #changer ).css( background-image , images[i]);
switch(id)
{
    case 2:
        $( #product ).animate({ backgroundColor:  #FFCD00  }, 500);
        $( #pmore ).animate({ backgroundColor:  #FFCD00  }, 500);
    break;
    case 3:
        $( #product ).animate({ backgroundColor:  #F7A604  }, 500);
        $( #pmore ).animate({ backgroundColor:  #F7A604  }, 500);
    break;
    case 4:
        $( #product ).animate({ backgroundColor:  #9A05E8  }, 500);
        $( #pmore ).animate({ backgroundColor:  #9A05E8  }, 500);
    break;
    case 5:
        $( #product ).animate({ backgroundColor:  #096EE3  }, 500);
        $( #pmore ).animate({ backgroundColor:  #096EE3  }, 500);
        break;
    case 6:
        $( #product ).animate({ backgroundColor:  #24A205  }, 500);
        $( #pmore ).animate({ backgroundColor:  #24A205  }, 500);
    break;
    case 0:
        $( #product ).animate({ backgroundColor:  #D41E0C  }, 500);
        $( #pmore ).animate({ backgroundColor:  #D41E0C  }, 500);
    break;
    case 1:
        default:
        $( #product ).animate({ backgroundColor:  #44B2EE  }, 500);
        $( #pmore ).animate({ backgroundColor:  #44B2EE  }, 500);
}
$( #changer ).cross();

}); });

BTW。 现在点击 does

最佳回答

诸如

问题回答

@Misiur

很抱歉说,你所贴出的链接含有一种 j脚印错误。

var images = new Array();
 images[] =  images/products/cat/1.jpg ;
 images[] =  images/products/cat/2.png ; 

页: 1 认为它应该像这样做。

var images = new Array();
 images[0] =  images/products/cat/1.jpg ;
 images[1] =  images/products/cat/2.png ;

如果我错(或)误导你,请让我





相关问题
Using QCView and iSight to capture image

I have a QCView that loads a Quartz file which gives you iSights feedback (basically like a QTCaptureView) Everything displays fine The button simply takes a snapshot using the following simple ...

Taking picture with QTCaptureView

Is it possible to simply take a picture and save it somewhere using a QTCaptureView and Apple s built-in iSight? I ve seen lots of tutorials on recording video but none on simply taking a picture. Any ...

Transform rectangular image into trapezoid

In .NET how can I transform an image into a trapezoid. The Matrix class supports rotation, shear, etc, but I can t see a trapezoidal transformation. I m using the usual System.Drawing.* API, but I m ...

Rotate image through Y-axis on web page

What are my options for rotating an image on a web page through the Y-axis? I m not sure if I even have the terminology right. Is this called a rotate or a transform. Most of the searches that I ve ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...

Convert from 32-BPP to 8-BPP Indexed (C#)

I need to take a full color JPG Image and remap it s colors to a Indexed palette. The palette will consist of specific colors populated from a database. I need to map each color of the image to it s "...

热门标签