Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Can I do both static on blade

Can I do both static on dynamic blade?

{{ HTML::script('js/fullscreensearch.js'); }} {{ HTML::script('js/mousemove.js'); }}

because if I remove one of any static the other will work, and then I have tried vise verse. It does same thing. so I have an idea a file .js copy and paste in one of .js and remove an static. it still concerning vise verse. I have no idea why the other does not work.

Does anybody know why the both script does not along each other?

6 Answers

Just to clarify, if you include more than one HTML::script file, it doesn't work?

What kind of error do you get? Do you get a laravel error page?

If you check your page source, can you see the files that are meant to be being included?

You shouldn't need a semi-colon at the end of your incluide:

<?php

{{ HTML::script('js/vendor/jquery.js') }}

focus on click search and register the others are fine.

  1. ex error was the mousemove.js its not moving at all
  2. second was error does not showing because I have removed fullscreensearch.js.
  3. third ex error does not show the error register. I have removed both semi colon at the end. I made a video less than a minute what I mean is https://www.youtube.com/watch?v=zQ_uiPLIK6I&feature=youtu.be its vice verse.

If you're including both files correctly and can access these files via your page source, this is a javascript issue.

It's obviously working fine, so it sounds like there's a glitch loading both files on document ready? A quick fix which sometimes works is adding a time delay between initializations of each code piece.

Here what I have each file .js for a file fullscreensearch.js

$(function () {
    $('a[href="#search"]').on('click', function(event) {
        event.preventDefault();
        $('#search').addClass('open');
        $('#search > form > input[type="search"]').focus();
    });

    $('#search, #search button.close').on('click keyup', function(event) {
        if (event.target == this || event.target.className == 'close' || event.keyCode == 27) {
            $(this).removeClass('open');
        }
    });

    $('form').submit(function(event) {
        event.preventDefault();
        return false;
    })
});

and mousemove.js

$(document).ready(function(){
  $(document).mousemove(function(e){
     TweenLite.to($('body'), 
        .5, 
        { css: 
            {
                backgroundPosition: ""+ parseInt(event.pageX/8) + "px "+parseInt(event.pageY/'12')+"px, "+parseInt(event.pageX/'15')+"px "+parseInt(event.pageY/'15')+"px, "+parseInt(event.pageX/'30')+"px "+parseInt(event.pageY/'30')+"px"
            }
        });
  });
});

I am not sure where planning to put the delay time on the .js.

My Javascript is rusty.. but is there a reason you haven't added

$(document).ready(function(){ 

to both files? I don't think you need to use document.ready before closing body tags? I would play around with how you're calling each of your functions/actions and see if that helps.

no solve for me I will worry about it. later. I am new to javascript. thanks