admin管理员组文章数量:1025208
I'm using Advanced Custom Fields on my site, i want to display pictures for my gallery field on a presentable, elegant way. So i was thinking on do something like this:
.asp
My main issue is that i don't know how to put the php variables on the javascript code. Can you help?
The same css and the same script from the w3schools example, and this is my code:
<?php
$images = get_field('extra_photos');
if( $images ): ?>
<div class="row2">
<div class="column2" >
<?php foreach( $images as $image ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?> " onclick="myFunction(this);"/>
<?php endforeach; ?>
</div>
</div>
<!-- The expanding image container -->
<div class="container2">
<!-- Close the image -->
<span onclick="this.parentElement.style.display='none'" class="closebtn">×</span>
<!-- Expanded image -->
<img id="expandedImg" style="width:100%">
<!-- Image text -->
<div id="imgtext"></div>
</div>
<?php endif; ?>
/
I don't know why it displays the pictures like one by one line, i want to display them all next to each other. How can i do it?
I'm using Advanced Custom Fields on my site, i want to display pictures for my gallery field on a presentable, elegant way. So i was thinking on do something like this:
https://www.w3schools/howto/howto_js_tab_img_gallery.asp
My main issue is that i don't know how to put the php variables on the javascript code. Can you help?
The same css and the same script from the w3schools example, and this is my code:
<?php
$images = get_field('extra_photos');
if( $images ): ?>
<div class="row2">
<div class="column2" >
<?php foreach( $images as $image ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?> " onclick="myFunction(this);"/>
<?php endforeach; ?>
</div>
</div>
<!-- The expanding image container -->
<div class="container2">
<!-- Close the image -->
<span onclick="this.parentElement.style.display='none'" class="closebtn">×</span>
<!-- Expanded image -->
<img id="expandedImg" style="width:100%">
<!-- Image text -->
<div id="imgtext"></div>
</div>
<?php endif; ?>
http://electives-abroad/mnazi-mmoja-in-zanzibar-tanzania/
I don't know why it displays the pictures like one by one line, i want to display them all next to each other. How can i do it?
Share Improve this question edited May 6, 2019 at 3:06 Draws Ren Gundam asked May 6, 2019 at 2:14 Draws Ren GundamDraws Ren Gundam 251 gold badge2 silver badges6 bronze badges1 Answer
Reset to default 0Fixed it!
This is the resulting code:
<?php
$images = get_field('extra_photos');
if( $images ): ?>
<div class="row2">
<?php foreach( $images as $image ): ?>
<div class="column2" >
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?> " onclick="myFunction(this);"/>
</div>
<?php endforeach; ?>
</div>
<!-- The expanding image container -->
<div class="container2">
<!-- Close the image -->
<span onclick="this.parentElement.style.display='none'" class="closebtn">×</span>
<!-- Expanded image -->
<img id="expandedImg" style="width:100%">
<!-- Image text -->
<div id="imgtext"></div>
</div>
<?php endif; ?>
I'm using Advanced Custom Fields on my site, i want to display pictures for my gallery field on a presentable, elegant way. So i was thinking on do something like this:
.asp
My main issue is that i don't know how to put the php variables on the javascript code. Can you help?
The same css and the same script from the w3schools example, and this is my code:
<?php
$images = get_field('extra_photos');
if( $images ): ?>
<div class="row2">
<div class="column2" >
<?php foreach( $images as $image ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?> " onclick="myFunction(this);"/>
<?php endforeach; ?>
</div>
</div>
<!-- The expanding image container -->
<div class="container2">
<!-- Close the image -->
<span onclick="this.parentElement.style.display='none'" class="closebtn">×</span>
<!-- Expanded image -->
<img id="expandedImg" style="width:100%">
<!-- Image text -->
<div id="imgtext"></div>
</div>
<?php endif; ?>
/
I don't know why it displays the pictures like one by one line, i want to display them all next to each other. How can i do it?
I'm using Advanced Custom Fields on my site, i want to display pictures for my gallery field on a presentable, elegant way. So i was thinking on do something like this:
https://www.w3schools/howto/howto_js_tab_img_gallery.asp
My main issue is that i don't know how to put the php variables on the javascript code. Can you help?
The same css and the same script from the w3schools example, and this is my code:
<?php
$images = get_field('extra_photos');
if( $images ): ?>
<div class="row2">
<div class="column2" >
<?php foreach( $images as $image ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?> " onclick="myFunction(this);"/>
<?php endforeach; ?>
</div>
</div>
<!-- The expanding image container -->
<div class="container2">
<!-- Close the image -->
<span onclick="this.parentElement.style.display='none'" class="closebtn">×</span>
<!-- Expanded image -->
<img id="expandedImg" style="width:100%">
<!-- Image text -->
<div id="imgtext"></div>
</div>
<?php endif; ?>
http://electives-abroad/mnazi-mmoja-in-zanzibar-tanzania/
I don't know why it displays the pictures like one by one line, i want to display them all next to each other. How can i do it?
Share Improve this question edited May 6, 2019 at 3:06 Draws Ren Gundam asked May 6, 2019 at 2:14 Draws Ren GundamDraws Ren Gundam 251 gold badge2 silver badges6 bronze badges1 Answer
Reset to default 0Fixed it!
This is the resulting code:
<?php
$images = get_field('extra_photos');
if( $images ): ?>
<div class="row2">
<?php foreach( $images as $image ): ?>
<div class="column2" >
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?> " onclick="myFunction(this);"/>
</div>
<?php endforeach; ?>
</div>
<!-- The expanding image container -->
<div class="container2">
<!-- Close the image -->
<span onclick="this.parentElement.style.display='none'" class="closebtn">×</span>
<!-- Expanded image -->
<img id="expandedImg" style="width:100%">
<!-- Image text -->
<div id="imgtext"></div>
</div>
<?php endif; ?>
本文标签: phpJavascript Tab Gallery with Advanced Custom Fields
版权声明:本文标题:php - Javascript Tab Gallery with Advanced Custom Fields 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745522116a2154359.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论