Tagged: Vinay
-
AuthorPosts
-
June 11, 2016 at 2:00 pm #646544
Hi,
I have a little new project, live preview:
http://susanvinczeller.com/
Its not Enfold, but I would like to rebuild this site with Enfold! :)The only one function what I can not rebuild the jQuery Directional Hover effect on images. I found jquery but how can I use this script with Enfold ALB simple image element?
Demo
http://www.jqueryscript.net/demo/Mouse-Direction-aware-jQuery-Hover-Effect-Plugin-Directional-Hover/Best regards
PeterJune 11, 2016 at 2:20 pm #646547Hey Peter,
Very interesting project.
First you need to enqueue the 3rd party js and css files using functions.
example functions
Then check the script documentation if it need to be initiated and then match the class names to the enfold gallery.
or
You can use a plugin like
https://wordpress.org/plugins/portfolio-gallery-master/
https://wordpress.org/plugins/hover-board-direction-aware-hover-effect/more plugins here > https://wordpress.org/plugins/search.php?q=directional+hover
Best regards,
VinayJune 11, 2016 at 3:47 pm #646563Hi,
So…
1. Copy the jquery files to /enfold-child/directional-hover/…
2. Put this code to my enfold child function phpfunction directional_hover_scripts() { wp_enqueue_style( 'jquery.directional-hover', get_stylesheet_directory_uri() . '/directional-hover/src/jquery.directional-hover.css, array(), false, true ); wp_enqueue_script( 'jquery.directional-hover.min', get_stylesheet_directory_uri() . '/directional-hover/src/jquery.directional-hover.min.js', array(), false, true ); } add_action( 'wp_enqueue_scripts', 'directional_hover_scripts' );
Is it good?
3. The script site just say this: Load the jQuery directional hover plugin after jQuery library. So I need the 2nd step, or enogh put this two line to header php?
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script> <script src="jquery.directional-hover.min.js"></script>
4. After the load I should put this classes to ALB simple image element overlay effect…
<div class="dh-container"> <div class="dh-overlay"></div> </div>
Best regards
PeterJune 11, 2016 at 7:38 pm #646619Hi,
I will have to personally install this and check the code on my installation to see if this works or not and that would take some time.
I will keep you posted in the meantime if you figure this one out let us know.
Best regards,
VinayJune 11, 2016 at 8:38 pm #646639Thank you! :) I know, you are the best support team! :)
Cheers!
PeterJune 11, 2016 at 10:10 pm #646677Hi,
Thank you for the kind words :)
Best regards,
VinayJune 14, 2016 at 4:22 pm #648103Hi Vinay,
This is the Enfold version live demo
What do you think will the directional hover work?http://susanvinczeller.corewebstudio.net/
Best regards
PeterJune 16, 2016 at 10:20 pm #649431Hi,
Sorry for the delay, The live version looks great. I have been a little tied up with helping others. I’ll let you know real soon about the script.
Best regards,
VinayJune 17, 2016 at 11:52 am #649729Hi,
Add the script files inside the main theme ‘enfold/css’ and ‘enfold/js’ folder.
To enqueue the 3rd party script files in wordpress please use the below code in child theme functions.php/* CSS files */ function dhover_styles() { wp_register_style( 'directional_hover', get_template_directory_uri() . '/css/jquery.directional-hover.css' ); wp_enqueue_style( 'directional_hover'); } add_action( 'wp_enqueue_scripts', 'dhover_styles'); /* JS files */ function dhover_js() { wp_register_script('directional_hover', get_template_directory_uri() . '/js/jquery.directional-hover.js', array('jquery'), true ); wp_enqueue_script('directional_hover'); } add_action('wp_enqueue_scripts', 'dhover_js'); // function to add dhover classes function dhover_func(){ ?> <script> jQuery(window).load(function(){ var imgContainer = jQuery('.avia-image-container'); imgContainer.find('.image-overlay').addClass('dh-container'); imgContainer.find('.image-overlay-inside').addClass('dh-overlay'); }); </script> <?php } add_action('wp_head', 'dhover_func');
I have verified the above code in my installation and it loads the css and js script correctly and add’s the required class names to the themes default image overlay class. However the script don’t seem to work yet may be you need to go through the script documentation and check again where to include the css class names. It will take us more time to study the script documentation and integrate a 3rd party script to the theme and i’m sorry to say this is how far we can help you with integrating of a 3rd party script.
Thank you for your understanding, let us know if you have any questions.
Best regards,
Vinay- This reply was modified 8 years, 6 months ago by Vinay.
June 26, 2016 at 9:10 pm #653616Hi
Sorry for the delay… it’s work! :) Thank you!
Just this line missed: jQuery(‘.dh-container’).directionalHover();
And I changed the dh classes’ place./* CSS files */ function dhover_styles() { wp_register_style( 'directional_hover', get_template_directory_uri() . '/css/jquery.directional-hover.css' ); wp_enqueue_style( 'directional_hover'); } add_action( 'wp_enqueue_scripts', 'dhover_styles'); /* JS files */ function dhover_js() { wp_register_script('directional_hover', get_template_directory_uri() . '/js/jquery.directional-hover.js', array('jquery'), true ); wp_enqueue_script('directional_hover'); } add_action('wp_enqueue_scripts', 'dhover_js'); // function to add dhover classes function dhover_func(){ ?> <script> jQuery( document ).ready(function() { var imgContainer = jQuery('.avia-image-container'); imgContainer.find('.avia-image-container-inner').addClass('dh-container'); imgContainer.find('.av-image-caption-overlay-center').addClass('dh-overlay'); jQuery('.dh-container').directionalHover(); }); </script> <?php } add_action('wp_head', 'dhover_func');
.dh-overlay { background: rgba(20,20,20,.4); width: 100%; height: 100%; text-align: center; line-height: 400px; }
Best regards,
PeterJune 29, 2016 at 12:06 pm #654765Hi,
Looks very nice :) great work!! This will help many others.
Thank you for using Enfold.
Best regards,
Vinay- This reply was modified 8 years, 5 months ago by Vinay.
-
AuthorPosts
- The topic ‘jQuery Directional Hover on ALB's simple image element’ is closed to new replies.