Home>Support>Add JQuery moving Background

Add JQuery moving Background

Hello SiteOrigin team,

It has been a while since my last post because your theme is so great! I hope you all are doing great and I was wondering if you could assist me with the following issue:

We are building a website on a Vantage Premium child theme and would like to add a moving background with jQuery, we read all we could find on google about it but we still can’t seem to get it right.

this is the website: www.sp.servicioswebmex.com

this is what we are trying to achieve: http://www.spacefood.com.mx/?seccion=clientes&lang=es

Here is our jQuery code:

$(function(){
    //variable that controls background movement
    var blnDetener=true;
     
    //time interval for the background            
    var tmrFondo=setInterval(function(){
        if(!blnDetener){
            var strPosicion=$('.divFondo').css('background-position');
            var iPosicion=strPosicion.indexOf('px');
        }
    },10); 
    //cloud time interval
    var tmrNubes=setInterval(function(){
      //obtenemos el background-position
        var strPosicion=$('.divNubes').css('background-position');
        var iPosicion=strPosicion.indexOf('px');
        
        if(iPosicion!=-1){
            $('.divNubes').css('background-position',(parseInt(strPosicion.substr(0,iPosicion)))+1+'px 0');
        }else{
            $('.divNubes').css('background-position','5px 5px');
        }
    },70);
    $('#divFondo').hover(function(){
        blnDetener=false;
    },function(){
        blnDetener=true;
    });
});

we then uploaded the code to wordpress under the adress wp/content/css and add the code to execute it in wp_head() on the function.php folder

When we try our code it works great and the clouds move but once added to the website it does not move.

Hope you can help,
thanks in advance!
J.

URL: http://sp.servicioswebmex.com/

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 29 days ago Andrew Misplon
    Hi, I Work Here

    Hi Jose

    Good to hear from you. Everything is strong our side.

    This is unfortunately a custom development task and beyond what we’re able to assist with. If you’re looking to add a Parallax background then there are several plugin solutions. Here is a thread I wrote on one:

    Thread: How to add parallax scrolling to a Page Builder row.

    Hope you’re able to make progress. If at some point you need a little developer assistance we recommend Codeable.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More