使用Jquery选择父级的子ID

时间:2014-02-19 14:17:19

标签: jquery

如何在JQuery中的rsActiveSlide下选择rsMainSlideImage? 我尝试了以下但它不起作用。

 $(".rsActiveSlide .rsContent .rsMainSlideImage").elevateZoom({
        zoomType: "inner",
        cursor: "crosshair"
 });



<div class="rsContainer" style="transition-duration: 0s; transform: translate3d(0px, 0px, 0px);">
<div class="rsSlide  rsActiveSlide" style="left: 0px;">
<div class="rsContent" style="visibility: visible; opacity: 1; transition: opacity 400ms ease-in-out 0s;">
   <img data-zoom-image="image1.jpg" alt="image description" src="image1.jpg" data-rsw="700" 
class="rsImg rsMainSlideImage" style="width: 765px; height: 984px; margin-left: 4px; margin-top: 51px;">

    </div></div>

1 个答案:

答案 0 :(得分:1)

您的选择器正确,请确保DOM ready

中的代码

Fiddle Demo

$(function () {
    $(".rsActiveSlide .rsContent .rsMainSlideImage").elevateZoom({
        zoomType: "inner",
        cursor: "crosshair"
    });
});