문제

I am trying to use jquery plugin Color Box: http://www.jacklmoore.com/colorbox/

HTML:

<center>
    <div class='images'>
        <a class="group1" href="http://placehold.it/250x150" title="Фотография 1"><img src='http://placehold.it/250x150'></a> 
        <a class="group1" href="/media/images/background.jpg"> <img src='http://placehold.it/250x150'></a>
    </div>
</center>

JS:

$(".images img").colorbox({rel:'images', transition:"fade"});

When I click to image black blank screen is appearing, black box, where picture must be situadted, appearing, icon loading constanlty spinning and image is not loading. There are no any errors or messages. Only icon loading.

How I can solve this problem?

도움이 되었습니까?

해결책

Try this code:

$(".images > .group1").colorbox({rel:'images', transition:"fade"});

다른 팁

Try this:

<div style="text-align:center;">
    <div class='images'>
        <a class="group1" rel="images" href="http://placehold.it/250x150" title="Фотография 1"><img src='http://placehold.it/250x150'></a> 
        <a class="group1" rel="images" href="/media/images/background.jpg"> <img src='http://placehold.it/250x150'></a>
    </div>
</div>

What I did here Added a rel attribute to the images with the value images to match your code.

Note: <center> is deprecated. Use <div style="text-align:center;"> instead.

$(".images a").colorbox({rel:'group1', transition:"fade"});

Rel should make reference to the class ("group1"), and the plugin is applied to the < a > element, not the < img > inside it

http://www.jacklmoore.com/colorbox/example3/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top