Tagged: anchor link, Text block
-
AuthorPosts
-
June 25, 2014 at 2:40 pm #283607
Hi guys i am trying to ad anchor links to a page, the thing is that i am using one color section with a background image containing all the content, so i cant use different color sections to use the anchor link described here http://kriesi.at/documentation/enfold/add-anchors-to-your-page-for-single-page-navigation/
So how can i link to specific text block, or element other than color section?
http://abolengo.com.ar/?page_id=4185June 25, 2014 at 4:58 pm #283662Hi smorrone!
Please turn on custom CSS field for ALB elements – http://kriesi.at/documentation/enfold/turn-on-custom-css-field-for-all-alb-elements/
then add a custom class to your textbox, say “anchor-text”. Then add following code to functions.php file in Appearance > Editorfunction add_custom_script(){ ?> <script> jQuery(window).load(function(){ jQuery('.anchor-text').attr('id', 'anchor-text'); }); </script> <?php } add_action('wp_footer', 'add_custom_script');
then you should be able to target the textbox using #anchor-text ID
Regards,
YigitJune 25, 2014 at 6:37 pm #283711Yigit i followed the instructions and is not working. Also i have to target four different anchors, how i identify each one of them?
Can you check it please?June 25, 2014 at 6:44 pm #283712Hey!
Sorry i made a mistake in functions.php file of your child theme. Can you please connect via FTP and undo the changes i made? I have added the code i posted here – https://kriesi.at/support/topic/links-to-a-different-part-of-the-same-page/#post-283662
Best regards,
YigitJune 25, 2014 at 7:53 pm #283731Hey the site went off line!
Yes i can do that via ftp,
i replace the code with this one?function add_custom_script(){
?>
<script>
jQuery(window).load(function(){
jQuery(‘.anchor-text’).attr(‘id’, ‘anchor-text’);
});
</script>
<?php
}
add_action(‘wp_footer’, ‘add_custom_script’);June 25, 2014 at 9:09 pm #283753ok, done this put the site on line again… so far so good
i have to target four different anchors, how i identify each one of them?June 26, 2014 at 1:39 am #283853Hey!
I am so sorry about that! Please add folllowing code and customise the class names for each section as following
function add_custom_script(){ ?> <script> jQuery(window).load(function(){ if ( jQuery("div").hasClass(".custom-class-one") ) { jQuery(".custom-class-one").attr('id','custom-class-one') }; if ( jQuery("div").hasClass(".custom-class-two") ) { jQuery(".custom-class-two").attr('id','custom-class-two') }; if ( jQuery("div").hasClass(".custom-class-three") ) { jQuery(".custom-class-three").attr('id','custom-class-three') }; if ( jQuery("div").hasClass(".custom-class-four") ) { jQuery(".custom-class-four").attr('id','custom-class-four') }; }); </script> <?php } add_action('wp_footer', 'add_custom_script');
and please try not to use numbers as ID’s.
Cheers!
YigitJune 26, 2014 at 2:12 am #283863Thanks Yigit!
-
AuthorPosts
- The topic ‘Links to a different part of the same page’ is closed to new replies.