Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #415955

    Hello,

    Is there a way to make a gallery in which there is a thick overlay on the picture with a label and when you click on it the picture is opened?
    Something like this:

    https://www.dentcof.net/clinical-case/giuliano-implant-dentar

    Kind regards,
    Radoslav Mitov

    #416467

    Hi radoslavmitov!

    Please add following code to Functions.php file in Appearance > Editor

    function add_custom_image(){
    ?>
    <script>
     function changeImage() {
    
            if (document.getElementById("imgChange")) 
            {
                document.getElementById("imgChange").src = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png";
            }
        }
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_image');

    and add your image as following

    <img alt="" src="http://kriesi.at/wp-content/themes/kriesi/images/enfold.jpg" id="imgChange" onclick="changeImage()"  />

    using Code Block element

    Best regards,
    Yigit

    #417070

    Hello,

    Works perfectly but I wanted to do it the opposite way. So I have a lot of pages where I want to hide a lot of pictures. So can I do it this way: I have one default warning picture on the Functions.php file that shows firstly when you open the page and after that I set different picture for each page that opens in the Code Block element when you click on the default one?

    Kind regards,
    Radoslav Mitov

    #417659

    Hi!

    Not sure if I follow you correctly. Can you please provide a screenshot or a link to a page with this feature?

    Regards,
    Ismael

    #417694

    Hello,

    So you can see here ( https://www.dentcof.net/clinical-case/giuliano-implant-dentar ) that there is one picture that opens first when you open the page – black one with some text on it. When you click on it opens the other picture.

    So when I have a lot of pages where I want when you open the page firstly to open this same black picture with text and when you click on it to open another photo.

    So this way we have one common black picture with text for a lot of pages, but when you click on each one a different photo is opening. With your solution it is the opposite. I set with the code block element specific picture for each page which opens first and when I click on it opens the picture which is set in the Functions.php file. I want to do it the opposite way.

    I hope you understand me now.

    Kind regards,
    Radoslav Mitov

    #418975

    Hi Radoslav!

    Try with the following instead:

    function add_custom_image(){
    ?>
    <script>
     function changeImage($this, image) {
       $this.setAttribute("src", image);
     }
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_image');

    The img structure would be like this:

    <img src="https://placekitten.com/g/200/300" onClick="changeImage(this, 'http://kriesi.at/wp-content/themes/kriesi/images/logo.png')" />
    

    You can see it working here:
    http://jsbin.com/fovovihije/edit?html,js,output

    Best regards,
    Josue

    #419225

    Hello,

    Can you tell me in this code

    function add_custom_image(){
    ?>
    <script>
     function changeImage($this, image) {
       $this.setAttribute("src", image);
     }
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_image');

    Where I should place the URL of the image?

    Kind regards,
    Radoslav Mitov

    #419231

    Hello,

    I figured it out. Thank you so much. Works fine now.

    Kind regards,
    Radoslav Mitov

    #419234

    Hello,

    Just final question. Can I activate lightbox on the second image?

    Kind regards,
    Radoslav Mitov

    #419519

    Hm, i don’t think that would be possible because lightbox activation happens before the image switch would occur.

    Best regards,
    Josue

    #419822
    This reply has been marked as private.
    #419881

    Hi,

    Can you post the link to that page?

    Regards,
    Josue

    #420119

    Hello,

    This is the link to the page: http://m3dent.com/total-restoration-3

    Kind regards,
    Radoslav Mitov

    #420647

    Hey!

    Please change your code to following one

    .page-id-3245 #av-masonry-1 a, .page-id-3245 #av-masonry-2 a, .page-id-3234 #av-masonry-1 a, .page-id-3234 #av-masonry-2 a, .page-id-3261 #av-masonry-2 a, .page-id-3253 #av-masonry-1 a, .page-id-3683 #av-masonry-1 a, .page-id-3683 #av-masonry-2 a, .page-id-3694 #av-masonry-1 a, .page-id-3694 #av-masonry-2 a {
      left: 25%!important;
    }

    To center it perfectly, you can place empty 1/4 column elements on both sides and place masonry element inside 1/2 column element

    Cheers!
    Yigit

    #423416

    Hello,

    Everything is fine now.

    Thank you for the support.

    Kind regards,
    Radoslav Mitov

    • This reply was modified 9 years, 7 months ago by radoslavmitov.
Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘Support request’ is closed to new replies.