簡體   English   中英

如何為wordpress中的每個圖像制作jQuery腳本?

[英]How can I make a jQuery script for each image featured in wordpress?

我希望每個wordpress特色圖片都可以產生特殊效果,請在Jquery中舉個例子幫助我?

我會幫一個例子

我是初學者,因此請您提供幫助

我對在Wordpress中起作用的效果感興趣...因為靜態(其他)知道如何執行此操作

示例可以是任何事情,我想知道如何在WP中調用Jquery中的所有圖像。

提前致謝!

如果所有精選圖像都具有相同的類(wp-post-image):

$('.wp-post-image').each(function(index,element){
 // $(element) is Your current featured image
 //add mouseenter and mouseleave event
 $(element).hover(function() {
  //add css class or style element with JS
  $( this ).addClass( "hover" );
 }, function() {
  //remove css class or style element with JS
  $( this ).removeClass( "hover" );
 });
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM