Tagged: x
-
AuthorPosts
-
October 26, 2016 at 4:26 pm #1232135
Studio172ParticipantHello, I have a question about highlighting a chosen image.
If I hover over the photographs of the people at:
http://frank.pilihan.nl/#wie
I get a blue line, i wish also to have a blue line when an image was clicked/selected.I have this css on the images:
mw img:focus{
outline: 4px solid #04508c;
}
mw img:active{
outline: 4px solid #04508c;
}
mw img:hover {
outline:4px solid #04508c;
}Only the hover seems to work… Or do I do something completely wrong with my css?
October 26, 2016 at 10:24 pm #1232559
RadModeratorHi there,
Thanks for posting in.
It’s not applicable for images since it doesn’t have focus styling like links and form inputs. Those are just images 🙂
Instead, please add this code to Admin > Appearance > Customizer > Custom > Javascript
jQuery( function($){ $( '.home #wie .x-container:last-child img' ).on('click', function(){ $(this).parent().parent().find('img').removeClass('active_img'); $(this).addClass('active_img'); } ); } );Then add this CSS
.active_img { outline:4px solid #04508c; }Hope this helps.
October 27, 2016 at 8:21 am #1233122
Studio172ParticipantHello Rad, thanks for your quick answer!
And sorry for my poor CSS knowledge… have to learn more about CSS…I added your scripts, but it doesn’t seem to do the trick… Can you explain what you are trying to do with the .active_img class. Is this a x theme class?
greetings, Stefan
October 27, 2016 at 10:03 am #1233257
RupokMemberHi Stefan,
I have tested the code and it should work fine as it’s working through console. I can see you have some other scripts above this and one of them are not closed properly. You can take off them to to test the code. You can also place the code within page level CSS under Cornerstone Settings Tab > Custom if you need the code only for the page.
Cheers!
October 27, 2016 at 10:21 am #1233284
Studio172ParticipantHello Rupok,
Thanks for looking into this issue!
But if I add some alert feedback:jQuery( function($){
window.alert(“hello”);
$( ‘.home #wie .x-container:last-child img’ ).on(‘click’, function(){
window.alert(“hello2”);$(this).parent().parent().find(‘img’).removeClass(‘active_img’);
$(this).addClass(‘active_img’);} );
} );
I get to see the ‘hello’ alert, but the ‘hello2’ alert never happens even if I click on the images…
greetings, stefan
October 27, 2016 at 12:57 pm #1233534
JadeModeratorHi Stefan,
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / passwordDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
October 27, 2016 at 2:28 pm #1233656
Studio172ParticipantThis reply has been marked as private.October 27, 2016 at 10:26 pm #1234206
Rue NelModeratorHello There,
Thanks for providing the information. The JS code should be updated and make use of this code instead:
jQuery( function($){ $(window).load(function(){ window.alert("hello"); $( '#medewerkersfotoveld img' ).each(function(){ $(this).on('click', function(){ window.alert("hello2"); $(this).parent().parent().find('img').removeClass('active_img'); $(this).addClass('active_img'); }); }); }); });If you need anything else, please let us know.
October 28, 2016 at 5:15 am #1234607
Studio172ParticipantHello Rue, thanks for your solution!
I’m still having some problems with synchronizing stuff, as I generate the images on the page with php/ajax, the script above is triggered too soon (before the images are on the page).
I realize this is far beyond the scope of your theme, so I understand if you don’t have the time to answer my question…
Can you perhaps give me a clue how i can trigger this script from my ajax call:
function maakmedewerkersfotos() {
var veld = document.getElementById(“medewerkersfotoveld”);$.ajax({
url: ‘/wp-admin/admin-ajax.php’,
method: ‘POST’,
dataType: ‘html’,
data: {
action: ‘medewerkersfotos’
},
success: function(data) {
//window.alert(data);
veld.innerHTML = data;
selecteermedewerker(STARTMEDEWERKERDICKSLUIS);//HERE I WOULD LIKE TO TRIGGER THE SCRIPT
}
});
}October 28, 2016 at 6:51 am #1234674
Studio172ParticipantNEVER MIND!
Already found the solution!!!with $(window).ajaxSuccess
Thanks for all your help!
October 28, 2016 at 8:19 am #1234738
Paul RModeratorYou’re welcome! 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1232135 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
