Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Conflict between Jquery and "scroll to top" function

Conflict between Jquery and "scroll to top" function

Scheduled Pinned Locked Moved General Discussion
4 Posts 2 Posters 174 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jacopoeffeJ Offline
    jacopoeffeJ Offline
    jacopoeffe
    wrote on last edited by jacopoeffe
    #1

    Hi Armin, hi Marius.
    I'm experimenting an issue with a thing I wanted to put into my website.

    This is my problem: I'm trying to put this JS code in order to change a word randomly with a series of other words.
    This is the code I put into the "head" section.

    <script type="text/javascript">
    // Array of words
    var words = ['*', 'web' , 'graphic' , 'visual' , 'digital' , 'icon' , 'logo' , 'UI' , 'UX' , 'editorial' , 'infographic' , '(basic) illustration' , '(basic) video' , 'type' ];
    // Function that executes every 2000 milliseconds
    var t = setInterval(function() {
      // Random number generator
      var randomNumber = Math.round( Math.random() * (words.length-1) );
      // Change the word in the span for a random one in the array of words
      $('#changing').html( words[ randomNumber ] );
    }, 2000);
    </script>
    

    Unfortunately, if I put only this code it doesnt' work,
    So I tried to add this thing because I supposed the function needed Jquery:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    

    And eventually the trick worked, but after that implementation I saw that the "scroll to top" feature doesn't work anymore.

    So, what can I do if I want to keep both things full working but at the same time avoiding that kind of conflicts?

    Thanks a lot.
    Jacopo

    https://www.jacopofaggian.net

    1 Reply Last reply
    0
    • mariusjopenM Offline
      mariusjopenM Offline
      mariusjopen
      Global Moderator
      wrote on last edited by
      #2

      Dear @jacopoeffe
      Have a look here: http://laytheme.com/documentation.html#custom-javascript There is everything written you need to know for working with Javascript or jQuery in LayTheme.
      Best!
      Marius

      www.mariusjopen.world

      1 Reply Last reply
      1
      • jacopoeffeJ Offline
        jacopoeffeJ Offline
        jacopoeffe
        wrote on last edited by
        #3

        Thank you @mariusjopen , i found the perfect solution for my problem, and it worked perfectly!

        "When using jQuery, please use 'jQuery' instead of '$'"

        Great, thanks for your suggestion & help.
        Have a nice Easter.
        Jacopo

        https://www.jacopofaggian.net

        1 Reply Last reply
        0
        • mariusjopenM Offline
          mariusjopenM Offline
          mariusjopen
          Global Moderator
          wrote on last edited by
          #4

          Dear @jacopoeffe
          classic…
          Great!
          Best!
          Marius

          www.mariusjopen.world

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          I also code custom websites or custom Lay features.
          💿 Email me here: 💿
          info@laytheme.com

          Before you post:
          1. When using a WordPress Cache plugin, disable it or clear your cache.
          2. Update Lay Theme and all Lay Theme Addons
          3. Disable all Plugins
          4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

          This often solves issues you might run into

          When you post:
          1. Post a link to where the problem is
          2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
          3. If the problem is difficult to explain, post screenshots / link to a video to explain it
          Online Users
          arminunruhA
          arminunruh
          F
          francesco
          L
          lurchifon
          Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
          laytheme.com
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Recent
          • Tags
          • Popular
          • Users
          • Search