MailChimp subscribe popup not displaying but displaying after admin login - wordpress

I am using MailChimp subscribe popup on my Wordpress website. I am getting one issue. I added the below code on my website.
<script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/unique-methods/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>
<script type="text/javascript">window.dojoRequire(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us5.list-manage.com","uuid":"e47ee5fe210b931aa5a748840","lid":"2b074a0a8b","uniqueMethods":true}) })</script>
I am not getting the popup on my website but if I log in to the WordPress and refresh the page then I am getting the popup.
I checked in the console I am getting the error
TypeError: window.dojoRequire is not a function

Sounds like a load order issue. Try moving those lines to the footer - before the body close tag.

Related

Wordpress Infinite scroll & facebook like,share box

I made a site http://18union.cc/, and used the infinite scroll in homepage.
When I scroll down, the facebook like&share box doesn't show up.
I have tried many methods, but it didn't work.
How could I fix this?
You will need to reinitialize the facebook script after the Ajax completes.
You can add your code between this code:
jQuery( document ).ajaxComplete(function() {
jQuery( ".log" ).text( "Add Facebook initialisation here." );
})
You should add this in your custom javaScript file.

How to use jquery Backstretch in asp.net mvc

How to use backstretch in asp.net MVC. I included script files in my view page after when I run my program the image is not shown in the browser.
Here is the code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="~/Scripts/jquery.backstretch.min.js"></script>
<script>
$.backstretch([ "Images/img1.jpg",
"Images/img2.jpg],
{
fade:750,
duration:10000
});
</script>
It is just syntax error. You don't have a closing quotation mark for img2.jpg.
It should be
$.backstretch([ "Images/img1.jpg",
"Images/img2.jpg"],
{
fade:750,
duration:10000
});
Make use of developer tools in a browser (example: In Google Chrome F12 will take you to dev tools) to identify javascript errors. Switch to console tab to see the errors. and you can click on the link on the right hand side to locate the error.

How to display an alert only once when user click anywhere

I am using javascript and I need to display an alert only once when the user click anywhere in the site. But make sure it will not pop up everytime the user click anywhere.
Im not professional but I need this code to embed in my e-commerce site. I have tried a regular onload alert. but it will show once the page is loaded. then i tried this automatic code:
</html>
<head>
<script language="JavaScript">
<!--
document.onclick = myClickHandler;
function myClickHandler() {
alert("All orders require minimum two weeks notice due to the nature of event and wedding products");
}
-->
</script>
</head>
<body>
</html>
and works, but every time I click appear and that is annoying. I need a onclick event, anywhere in the page... to display an alert only once. to advise the user about important info.
Desperatly need some solution. Thanks
$(function () {
$(document).on('click.once', function () {
alert("Alerted once");
$(document).off('click.once');
})
});
This makes use of the .off() and named event feature in jQuery.
.off feature
event namespaces

How to open a new windows on body load in blogger?

I have my blog under url http://www.funjin.blogspot.com and i want to open a new window having specific url when the blog loads. Can anybody help?
You can use javascript to open a popup window when a user logs on. However, if you have a popup blocker installed, it won't open at all. Also, some browsers will not allow popups at all. It would be better to have the user click a link and then the popup opens.
<script type="text/javascript">
window.onload = function() {
window.open('http://www.google.com','google',' menubar=0, resizable=0,dependent=0,status=0,width=300,height=200,left=10,top=10')
}
</script>
Change the settings for url, width, and height to whatever you need.

jQuery ready function doesn't work in WordPress

I'm using jQuery at WordPress (#the HOME page) and the ready function doesn't work for me. I have a index.php which is including (php) a header, footer and a sidebar. I tested this code:
<script type="text/javascript" src="path_to_jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
alert ("test text");
});
</script>
The alert (with the text "test text") is just not popping up immediately! It's only popping up after my sidebar has been loaded. This means while I'm seeing the index page (sidebar is not loaded yet) I have to wait a few seconds until the sidebar has finished loading, and only then the jQuery code is executed: the alert is popping up. So the ready function just wont work.
Can anybody tell me why and how I can solve this problem? Thanks.
within the WordPress environment, use this:
jQuery(function($){
// now you can use jQuery code here with $ shortcut formatting
// this executes immediately - before the page is finished loading
});
jQuery(document).ready(function($){
// now you can use jQuery code here with $ shortcut formatting
// this will execute after the document is fully loaded
// anything that interacts with your html should go here
});
The alert is popping up after the sidebar is loaded because ready() is supposed to be executed AFTER the whole page is done loading.
The alert (with the text "test text") is just not popping up immediately! It's only popping up after my sitebar has been loaded.
That's exactly the advantage of using ready. When you want it to popup right away, simply do
<script type="text/javascript">
alert ("test text");
</script>

Resources