-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible bug with get_script_depends / before_enqueue_scripts #1666
Comments
Are you write your JS code like this structure: https://github.com/pojome/elementor-hello-world/blob/master/assets/js/hello-world.js ? |
I replaced all the code in the hello-word.js with:
Can you provide a simple code example with the above code using the hello-world example (Simple background color change)? It sounds like I'm not understanding your example located here: https://github.com/pojome/elementor-hello-world/blob/master/assets/js/hello-world.js |
You don't use global jQuery selector on your widget. You need to based on |
Unfortunately I don't understand what you are saying. I am trying to enqueue a javascript file only when a specific widget is called. If I use the default WordPress
and then adding get_script_depends for the widget area:
But it sounds like I will also need to wrap additional javascript around the code and refer to the $scope variable? I am either missing the concept or it is very difficult to do a simple enqueue of a javascript file per widget (For example including a prettyPhoto lightbox file for one widget). Perhaps you can put a simple example together using the code above for the hello-world widget code I was testing (that may help out as I don't understand the $scope variable and what is required)?
PS: I really appreciate the help and responsiveness. |
Like this:
Just change the |
@KingYes I had a question when you have |
Like this: |
Using the Hello World Plugin example for showing custom JS per widget (https://github.com/pojome/elementor-hello-world). I noticed the JavaScript doesn't load when the frontend editor is open:
I replaced the /assets/js/hello-world.js file with the code below to make a simple test changing the background color to yellow:
( function( $ ) { $(".elementor-widget-container").css("background-color", "yellow"); } )( jQuery );
Screen-shot when viewing normally: http://i.imgur.com/noWYvsQ.png
Screen-shot when front-end editor open (No yellow highlight): http://i.imgur.com/RWAy3vo.png
Let me know if this is a bug or of I am doing something wrong.
The text was updated successfully, but these errors were encountered: