-
Author
-
April 11, 2014 at 19:05 #14841jdtoppinParticipant
Where is the scroll to top script? I can’t find it for the life of me.
I’ve added a new script, but for some reason it breaks the Scroll to Top in Chrome and I can’t figure out why. Scroll to Top button still works fine in Firefox, but it breaks it in Chrome, UNLESS you’re on a page where the Tooltip script has to load its resources.
For reference, see: http://www.someguild.com (doesn’t work: scrolls up twice without smoothness, then breaks) vs. http://www.someguild.com/forums/topic/test-topic/ (works for some reason).
April 12, 2014 at 02:14 #14858KieranParticipantTested your site for you under Windows 8 using Chrome, Firefox and IE – I do not encounter the issue you have stated.
A side note: “©2014 Someguild.com site design by Moobid” in the footer is not true, if credit for the design is to be awarded anywhere it should be to SeventhQueen (http://themeforest.net/user/SeventhQueen) or not at all. Just a thought is all.
April 12, 2014 at 02:37 #14863sharmstrModeratorWindows 7 w/Chrome works fine.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
April 12, 2014 at 03:32 #14866jdtoppinParticipantYes, the wording is poor there and needs to be changed. However, “site developed by” should be appropriate as sites are developed after the fact.
As for it working, I changed the script from enqueue in the function file to directly putting it in the footer. Less than ideal for now, but it works.
April 12, 2014 at 03:56 #14869sharmstrModeratorPerhaps you know this and it didnt work, but $in_footer is a valid flag for wp_enqueue_script. No need to put it in the footer file.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
April 12, 2014 at 22:15 #14964jdtoppinParticipantYeah, I’ve tried that sadly. 🙁
Check it out now with it enqueue’d in the footer.
Doesn’t work… it should load dependencies, but it does not and breaks the scroll to top.
COPY CODEfunction wpb_adding_scripts() { wp_register_script('DarkTip', get_stylesheet_directory_uri() . '/darktip/DarkTip.js', '','1.1.5', true); wp_enqueue_script('DarkTip'); } add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );
That is the code in my child theme function file that breaks it.
When I load in footer, I use:
COPY CODE<script type="text/javascript"> window.___DarkTipSettings = { 'resources': { 'qtip2' : [ 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/ext/qtip2/jquery.qtip.min.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/ext/qtip2/jquery.qtip.min.css' ], 'extras': [ 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.css', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.realm.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.quest.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.item.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.item.equipped.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.character.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.character.spec.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.character.pvp.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.guild.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.arena.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.achievement.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.spell.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.wowhead.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.wowhead.achievement.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.wowhead.character.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.wowhead.guild.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.wowhead.item.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.wowhead.quest.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/wow.wowhead.spell.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/d3.css', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/d3.js', 'http://www.someguild.com/wp-content/themes/kleo-child/darktip/modules/d3.profile.js' ] } }; </script> <script type="text/javascript" src="http://www.someguild.com/wp-content/themes/kleo-child/darktip/DarkTip.js"></script>
So it is loading all the resources with it.
April 13, 2014 at 01:06 #14975sharmstrModeratorIts not loading the dependencies because you didn’t define them. WordPress doesn’t automagically know what your scripts dependencies are. http://codex.wordpress.org/Function_Reference/wp_register_script#Example_of_Automatic_Dependency_Loading
For the dependent css files, you’d use wp_enqueue_style()
I’m guessing the built in jQuery ui tooltip script doesn’t satisfy your needs, maybe?
Side note. Use ‘pre’ open and close tags around your code instead of ‘code’ tags. Confusing I know.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
April 13, 2014 at 01:12 #14977jdtoppinParticipantWell, I had tried this previously to no avail:
COPY CODEfunction wpb_adding_scripts() { wp_register_script('DarkTip', get_stylesheet_directory_uri() . '/darktip/DarkTip.js'); wp_register_script('qtip_js', get_stylesheet_directory_uri() . '/darktip/ext/qtip2/jquery.qtip.min.js'); wp_register_script('wow', get_stylesheet_directory_uri() . '/darktip/modules/wow.js'); wp_register_script('wow_realm', get_stylesheet_directory_uri() . '/darktip/modules/wow.realm.js'); wp_register_script('wow_quest', get_stylesheet_directory_uri() . '/darktip/modules/wow.quest.js'); wp_register_script('wow_item', get_stylesheet_directory_uri() . '/darktip/modules/wow.item.js'); wp_register_script('wow_item_equipped', get_stylesheet_directory_uri() . '/darktip/modules/wow.item.equipped.js'); wp_register_script('wow_character', get_stylesheet_directory_uri() . '/darktip/modules/wow.character.js'); wp_register_script('wow_character_spec', get_stylesheet_directory_uri() . '/darktip/modules/wow.character.spec.js'); wp_register_script('wow_character_pvp', get_stylesheet_directory_uri() . '/darktip/modules/wow.character.pvp.js'); wp_register_script('wow_guild', get_stylesheet_directory_uri() . '/darktip/modules/wow.guild.js'); wp_register_script('wow_arena', get_stylesheet_directory_uri() . '/darktip/modules/wow.arena.js'); wp_register_script('wow_achievement', get_stylesheet_directory_uri() . '/darktip/modules/wow.achievement.js'); wp_register_script('wow_spell', get_stylesheet_directory_uri() . '/darktip/modules/wow.spell.js'); wp_register_script('wow_wowhead', get_stylesheet_directory_uri() . '/darktip/modules/wow.wowhead.js'); wp_register_script('wow_wowhead_character', get_stylesheet_directory_uri() . '/darktip/modules/wow.wowhead.character.js'); wp_register_script('wow_wowhead_guild', get_stylesheet_directory_uri() . '/darktip/modules/wow.wowhead.guild.js'); wp_register_script('wow_wowhead_item', get_stylesheet_directory_uri() . '/darktip/modules/wow.wowhead.item.js'); wp_register_script('wow_wowhead_achievement', get_stylesheet_directory_uri() . '/darktip/modules/wow.wowhead.achievement.js'); wp_register_script('wow_wowhead_quest', get_stylesheet_directory_uri() . '/darktip/modules/wow.wowhead.quest.js'); wp_register_script('wow_wowhead_spell', get_stylesheet_directory_uri() . '/darktip/modules/wow.wowhead.spell.js'); wp_register_script('d3', get_stylesheet_directory_uri() . '/darktip/modules/d3.js'); wp_register_script('d3_profile', get_stylesheet_directory_uri() . '/darktip/modules/d3.profile.js'); wp_enqueue_script('DarkTip'); wp_enqueue_script('qtip_js'); wp_enqueue_script('wow'); wp_enqueue_script('wow_realm'); wp_enqueue_script('wow_quest'); wp_enqueue_script('wow_item'); wp_enqueue_script('wow_item_equipped'); wp_enqueue_script('wow_character'); wp_enqueue_script('wow_character_spec'); wp_enqueue_script('wow_character_pvp'); wp_enqueue_script('wow_guild'); wp_enqueue_script('wow_arena'); wp_enqueue_script('wow_achievement'); wp_enqueue_script('wow_spell'); wp_enqueue_script('wow_wowhead'); wp_enqueue_script('wow_wowhead_character'); wp_enqueue_script('wow_wowhead_guild'); wp_enqueue_script('wow_wowhead_item'); wp_enqueue_script('wow_wowhead_achievement'); wp_enqueue_script('wow_wowhead_quest'); wp_enqueue_script('wow_wowhead_spell'); wp_enqueue_script('d3'); wp_enqueue_script('d3_profile'); } add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' ); function wpb_adding_styles() { wp_register_style('qtip_style',get_stylesheet_directory_uri().'/darktip/ext/qtip2/jquery.qtip.min.css'); wp_register_style('wow_style',get_stylesheet_directory_uri().'/darktip/modules/wow.css'); wp_register_style('d3_style',get_stylesheet_directory_uri().'/darktip/modules/d3.css'); wp_enqueue_style('qtip_style'); wp_enqueue_style('wow_style'); wp_enqueue_style('d3_style'); } add_action( 'wp_enqueue_scripts', 'wpb_adding_styles' );
I think it is the
COPY CODE<script type="text/javascript"> window.___DarkTipSettings = {
Window part that I can’t figure out. Script author told me the script comes with its own async script/style loader… which is why I shortened it up to just the DarkTip script.
I mean, it works direct in the footer, just not with the enqueue, although I think I had it working once, but it was breaking the scroll to top.
April 13, 2014 at 01:28 #14982sharmstrModeratorAhhh. Got it.
Hmmm. Not sure if this would work, but maybe in your child functions you could use add_action(‘wp_footer’, ‘your_function’, 100); Then in your function you could use php require to call a .php file that has all of your code script/css calls in it (all of the stuff you are adding to the footer file.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
April 13, 2014 at 01:34 #14983sharmstrModeratorOr just echo it in the function. (to late to edit my response)
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
April 13, 2014 at 01:39 #14984jdtoppinParticipantOn a side note: What is with replies not showing up at the bottom of the thread in here? It is hard to follow sometimes.
Anyhow, I’ll have to dig into this a bit more when I have time and perhaps try your suggestion. My PHP skills are pretty bad, so it will require some reading. I think I get what you’re saying. To essentially put the entire part of the script call that works into a PHP file and just call that file? That would probably work since it would do essentially the same thing as putting it directly into the footer.
I’m just stumped as to why there is a conflict with the scroll to top when it is loaded via enqueue versus the other way around? Would it just be the order in which the scripts are being loaded since it is then using its own async load and putting it in the wrong spot with the rest of the code?
I haven’t noticed a huge performance hit in terms of load times with having it in the footer. I’m not sure how much data it is adding to a page load on a mobile device though. I assume it is negligible since the site is already pretty heavy on JS. Besides performance issues, are there other reasons to use enqueue versus directly adding the script to the footer?
April 13, 2014 at 01:48 #14985sharmstrModeratorregarding side note: Because I have a tendency to just use the form at the bottom of the page instead of clicking ‘reply’ on your last message.
Yes, that’s exactly what I mean. But like I followed up with, maybe you can just echo it in the function instead of calling a separate file.
And yes again, it usually has something to do with order. It requires jQuery, right? Maybe its loading before that?
Well when you get back to it, I’ll help if I can.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
April 14, 2014 at 23:48 #15099AbeKeymasterIt breaks the script since you have JavaScript errors. See it in your browser console:
TypeError: this.each is not a function
…data(“bs.modal”),g=a.extend({},b.DEFAULTS,e.data(),”object”==typeof c&&c);f||e.d…Also for the scripts to load in the footer you must add them a TRUE parameter like this example, otherwise they will load in the header:
COPY CODEwp_register_script( 'bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array('jquery'),KLEO_THEME_VERSION, true );
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.