Community Forums › Forums › Archived Forums › General Discussion › jQuery Slider in Genesis Child Theme
Tagged: jquery
- This topic has 5 replies, 3 voices, and was last updated 9 years, 5 months ago by jimena.
-
AuthorPosts
-
February 21, 2014 at 11:31 am #91716walkingmillerMember
Hello. I am porting over a site from a .net cms into a genesis child theme. The element of their old site that they were most excited about was a fancy jQuery slider that used a sliding accordion, thumbnail navigation (quite a mouthful). I am using slider revolution for the actual slider, and I am trying to use the code from the previous site for the navigation. Unfortunately, the navigation does not want to work (see below for a screenshot). I have loaded the javascript and style sheet through wp_register and wp_enqueue, but there seems to still be an issue. Here is the code in my functions.php:
add_action( 'wp_enqueue_scripts', 'scp_enqueue_ch_script');
function scp_enqueue_ch_script() {
wp_register_script('stage_set', get_stylesheet_directory_uri() . '/js/stage.set.js', array( 'jquery' ), '', true );
wp_register_script('stage', get_stylesheet_directory_uri() . '/js/stage.js', array( 'jquery' ), '', true );
wp_register_style('stage_css', get_stylesheet_directory_uri() . '/stage.css', '', '', 'screen');wp_enqueue_script( 'stage_set');
wp_enqueue_script( 'stage');
wp_enqueue_style( 'stage_css');
}Here is a fiddle for what is supposed to happen (I pasted both stage_set.js and stage.js into the same javascript field) -
Unfortunately, when I load the page with the appropriate code, here is a screenshot of what happens - The thumbnail navigation does not respond in any way.
The site seems to be loading the javascript, but there appears to be an issue with the way it is reading the javascript. I would appreciate any help. I wish the client wasn't so stuck on the particular navigation style, but they are insisting on using it. Please let me know if I can provide any further information.
Thank you,
walkingmillerJuly 6, 2015 at 1:58 pm #158540jimenaParticipantHi There!
I have a question about the Backstretch.js code, make it on my site and it works perfect , but it works on every page, and I just want it to work on home page. Any help on how to do this?
Thanks!
[URL=https://meettomy.site] Pretty Womans in your town[/URL]
July 7, 2015 at 5:38 pm #158723Brad DaltonParticipantAdd the
is_front_page()
conditional tag after the function.
Example http://codex.wordpress.org/Function_Reference/is_front_page#Examples
July 7, 2015 at 9:50 pm #158749jimenaParticipantHi Braddalton, Thanks for your help, but I can´t add the conditional tag after the function .
I´m using the theme agent press pro , this is the php code :
//* Add conditional rotating background images if static background image is not found if (!get_background_image() ) { add_action( 'wp_enqueue_scripts', 'wap_backstretch' ); function wap_backstretch() { wp_enqueue_script( 'backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0' ); wp_enqueue_script( 'backstretch-init', get_stylesheet_directory_uri() . '/js/backstretch-init.js', array( 'backstretch' ), '1.0.0' ); } }
[URL=https://meettomy.site] Pretty Womans in your town[/URL]
July 7, 2015 at 11:10 pm #158753Brad DaltonParticipantWhy?
add_action( 'wp_enqueue_scripts', 'wap_backstretch' ); function wap_backstretch() { if ( ! get_background_image() OR is_front_page() ) { wp_enqueue_script( 'backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0' ); wp_enqueue_script( 'backstretch-init', get_stylesheet_directory_uri() . '/js/backstretch-init.js', array( 'backstretch' ), '1.0.0' ); } }
Try change the
OR
to
AND
if needed.
Something like this. Not tested but you can use this code as a guide for testing.
July 8, 2015 at 9:15 am #158789jimenaParticipantThank you very much , it worked perfect!
[URL=https://meettomy.site] Pretty Womans in your town[/URL]
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.