Help - Search - Members - Calendar
Full Version: Code
HTMLHelp Forums > Web Authoring > Web Site Functionality
calico
Hello,

When I use the following HTML code it works just fine:

<script type="text/javascript">
boatload_puzzles_format = 'Landscape';</script>
<p>Loading <a href="https://www.boatloadpuzzles.com/playcrossword">
crossword puzzle</a>. One moment please.</p>
<script type="text/javascript"
src="//www.boatloadpuzzles.com/Crossword.js"></script>

But when I place this code within my Word Press site I get errors. Does anyone know what is going on here with the code?
CharlesEF
The first thing I would try is moving this line:
CODE
<script type="text/javascript" src="//www.boatloadpuzzles.com/Crossword.js"></script>
into the <head>...</head> section of the page.
calico
Thank you very much. But that doesn't appear to work.
CharlesEF
Well, ok, let's try one more thing. Change this line:
CODE
<script type="text/javascript"
src="//www.boatloadpuzzles.com/Crossword.js"></script>
Add 'http:' or 'https:' to the beginning of the 'src' attribute.
pandy
Don't think that will help either. It works with both http and https (tried locally), so as long as the document is online // should work.

Maybe the script clashes with another script.
CharlesEF
To be honest, I didn't think it would make a difference either. Maybe a script conflict is the problem.
pandy
Who wants to dig into WordPress's JavaScripts? laugh.gif
Christian J
QUOTE(calico @ Jan 23 2017, 11:31 PM) *

when I place this code within my Word Press site I get errors.

Could you post the errors here?
calico
Perhaps errors was a bad choice of words. When I place the code on my Word Press site, I see the output for a brief second and then it just disappears and the screen is blank.
pandy
I don't know if we can help, but to have a chance I think we need to see the page.
calico
http://www.intobserver.com/crossword/
pandy
The only JS error I get is this.
CODE
Warning: http://www.intobserver.com/wp-content/themes/advanced-newspaper/inc/js/jquery.cycle2.min.js?ver=4.7.1 is being assigned a //# sourceMappingURL, but already has one

Commenting that script out doesn't make a difference.

Using FF's Inspector I see that the crossword script writes an IFRAME - and loads a blank document in it.
CODE
<iframe style="width:575px; height:442px;" name="u148529991523092_" id="u148529991523092_" frameborder="0">
<html><head></head><body></body></html>
</iframe>


First I thought there might be some licensing involved and they catch you when the page is on the web. But your WP page doesn't run locally for me, so that's not it. But still, first the crossword flashes as you said, then the blank page is loaded. That feels like it's "them" doing it. wacko.gif

pandy
I found it. That doesn't mean I can fix it, but I found what it is. I thought I'd try removing all other JS. I got lucky with the first one I tried, the large style block. Commented it out and the crossword is back.

What is it for? Seems to be related to the menu, but your menu only has normal links, from the look of it at least.

CODE
        <!--     <script type='text/javascript'>
            (function($) {
                $(document).ready(function() {
                    $(".children").parent("li").addClass("has-child-menu");
                    $(".sub-menu").parent("li").addClass("has-child-menu");
                    $(".drop").parent("li").addClass("has-child-menu");
                    
                    $('.fadeimage').hover(
                        function() {$(this).stop().animate({ opacity: 0.5 }, 800);},
                        function() {$(this).stop().animate({ opacity: 1.0 }, 800);}
                    );
                    
                    $('.mastheadnav li ul,.mainnav li ul,.subnav li ul,.mastheadnav li ul,.mainnav li ul').hide().removeClass('fallback');
                    $('.mastheadnav > li,.mainnav > li,.subnav > li,.mainnav > li').hover(
                        function () {
                            $('ul', this).stop().slideDown(250);
                        },
                        function () {
                            $('ul', this).stop().slideUp(250);
                        }
                    );

                    $('[data-toggle="tooltip"]').tooltip({
                        'placement': 'top'
                    });    

                    $('.sidebar-wrapper, .post-wrapper')
                    .theiaStickySidebar({
                        additionalMarginTop: 30,
                        additionalMarginBottom: 30
                    });
                
                    /* InnerPage Slider */
                    var innerslider = $(".carousel-gallery");
                    innerslider.owlCarousel({
                      autoPlay: 999999,
                      pagination:true,
                      singleItem : true,
                      autoHeight : true,
                      mouseDrag: false,
                      touchDrag: false                      
                    });    
                    $(".carousel-gallery-next").click(function(){
                        innerslider.trigger('owl.next');
                    });
                    $(".carousel-gallery-prev").click(function(){
                        innerslider.trigger('owl.prev');
                    });
                    
                    /* InnerPage Slider */
                    var owl4 = $(".carousel-four");
                    owl4.owlCarousel({
                      autoPlay: 999999,
                      pagination:true,
                      singleItem : true,
                      autoHeight : true,
                      mouseDrag: false,
                      touchDrag: false                      
                    });    
                    $(".carousel-four-next").click(function(){
                        owl4.trigger('owl.next');
                    });
                    $(".carousel-four-prev").click(function(){
                        owl4.trigger('owl.prev');
                    });                        
                    
                    // Responsive Menu (TinyNav)
                    $(".responsive_menu").tinyNav({
                        active: 'current_page_item', // Set the "active" class for default menu
                        label: ''
                    });
                    $(".tinynav").selectbox();            
                    
                    $('a[href="#top"]').click(function(){
                        $('html, body').animate({scrollTop:0}, 'slow');
                        return false;
                    });
                    $('.modal').on('shown.bs.modal', function() {
                      $(this).find('[autofocus]').focus();
                    });                    
                });
            })(jQuery);
            </script> -->
calico
I genuinely appreciate everyone's input. I feel a little stupid, but apparently the problem was that for security reasons Word Press does not allow single page java script. I'm sure you can build a work-around into the site, but I just downloaded a plugin to allow for the use of javascript.
pandy
Fact remains it didn't run locally either - until I removed that block. Peculiar.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.