Custom popup in magento2
I have created a custom popup in list page .. I need to open the popup after 4 sec of every product addtocart.
And auto close the popup after 4 sec.
some time the popup suddenly closed within 4 sec....
How to slove this ...
$.ajax({
url: BASE_URL + this.options.posturl,
type: "POST",
datatype: "json",
data: {productId: productId},
success: function (response) {
$("#custom-popup").hide();
if (response['content']) {
$("#custom-popup").html(response['content']);
setTimeout(function () {
$("#custom-popup").show();
setInterval(function () {
$("#custom-popup").hide();
}, 4000);
}, 4000);
}
}
});
Thanks.
magento2.2 jquery
add a comment |
I have created a custom popup in list page .. I need to open the popup after 4 sec of every product addtocart.
And auto close the popup after 4 sec.
some time the popup suddenly closed within 4 sec....
How to slove this ...
$.ajax({
url: BASE_URL + this.options.posturl,
type: "POST",
datatype: "json",
data: {productId: productId},
success: function (response) {
$("#custom-popup").hide();
if (response['content']) {
$("#custom-popup").html(response['content']);
setTimeout(function () {
$("#custom-popup").show();
setInterval(function () {
$("#custom-popup").hide();
}, 4000);
}, 4000);
}
}
});
Thanks.
magento2.2 jquery
please check my answer and let me know if any query.
– Rohan Hapani
Jun 23 '18 at 18:56
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Remove $("#custom-popup").hide(); at success.
– Rohan Hapani
Jun 25 '18 at 4:52
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:03
add a comment |
I have created a custom popup in list page .. I need to open the popup after 4 sec of every product addtocart.
And auto close the popup after 4 sec.
some time the popup suddenly closed within 4 sec....
How to slove this ...
$.ajax({
url: BASE_URL + this.options.posturl,
type: "POST",
datatype: "json",
data: {productId: productId},
success: function (response) {
$("#custom-popup").hide();
if (response['content']) {
$("#custom-popup").html(response['content']);
setTimeout(function () {
$("#custom-popup").show();
setInterval(function () {
$("#custom-popup").hide();
}, 4000);
}, 4000);
}
}
});
Thanks.
magento2.2 jquery
I have created a custom popup in list page .. I need to open the popup after 4 sec of every product addtocart.
And auto close the popup after 4 sec.
some time the popup suddenly closed within 4 sec....
How to slove this ...
$.ajax({
url: BASE_URL + this.options.posturl,
type: "POST",
datatype: "json",
data: {productId: productId},
success: function (response) {
$("#custom-popup").hide();
if (response['content']) {
$("#custom-popup").html(response['content']);
setTimeout(function () {
$("#custom-popup").show();
setInterval(function () {
$("#custom-popup").hide();
}, 4000);
}, 4000);
}
}
});
Thanks.
magento2.2 jquery
magento2.2 jquery
edited 8 mins ago
Mano M
asked Jun 23 '18 at 11:17
Mano MMano M
799217
799217
please check my answer and let me know if any query.
– Rohan Hapani
Jun 23 '18 at 18:56
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Remove $("#custom-popup").hide(); at success.
– Rohan Hapani
Jun 25 '18 at 4:52
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:03
add a comment |
please check my answer and let me know if any query.
– Rohan Hapani
Jun 23 '18 at 18:56
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Remove $("#custom-popup").hide(); at success.
– Rohan Hapani
Jun 25 '18 at 4:52
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:03
please check my answer and let me know if any query.
– Rohan Hapani
Jun 23 '18 at 18:56
please check my answer and let me know if any query.
– Rohan Hapani
Jun 23 '18 at 18:56
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Remove $("#custom-popup").hide(); at success.
– Rohan Hapani
Jun 25 '18 at 4:52
Remove $("#custom-popup").hide(); at success.
– Rohan Hapani
Jun 25 '18 at 4:52
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:03
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:03
add a comment |
1 Answer
1
active
oldest
votes
Try to use this code :
$.ajax({
url: BASE_URL + this.options.posturl,
type: "POST",
datatype: "json",
data: {
productId: productId
},
success: function(response) {
if (response['content']) {
$("#custom-popup").html(response['content']);
setTimeout(function() {
$("#custom-popup").show();
setInterval(function() {
$("#custom-popup").hide();
}, 4000);
}, 4000);
}
}
});
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:04
No. It will be useful for after 4 sec hide popup. Please check in diff checker you get idea about what you want to do.
– Rohan Hapani
Jun 25 '18 at 6:07
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f231128%2fcustom-popup-in-magento2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try to use this code :
$.ajax({
url: BASE_URL + this.options.posturl,
type: "POST",
datatype: "json",
data: {
productId: productId
},
success: function(response) {
if (response['content']) {
$("#custom-popup").html(response['content']);
setTimeout(function() {
$("#custom-popup").show();
setInterval(function() {
$("#custom-popup").hide();
}, 4000);
}, 4000);
}
}
});
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:04
No. It will be useful for after 4 sec hide popup. Please check in diff checker you get idea about what you want to do.
– Rohan Hapani
Jun 25 '18 at 6:07
add a comment |
Try to use this code :
$.ajax({
url: BASE_URL + this.options.posturl,
type: "POST",
datatype: "json",
data: {
productId: productId
},
success: function(response) {
if (response['content']) {
$("#custom-popup").html(response['content']);
setTimeout(function() {
$("#custom-popup").show();
setInterval(function() {
$("#custom-popup").hide();
}, 4000);
}, 4000);
}
}
});
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:04
No. It will be useful for after 4 sec hide popup. Please check in diff checker you get idea about what you want to do.
– Rohan Hapani
Jun 25 '18 at 6:07
add a comment |
Try to use this code :
$.ajax({
url: BASE_URL + this.options.posturl,
type: "POST",
datatype: "json",
data: {
productId: productId
},
success: function(response) {
if (response['content']) {
$("#custom-popup").html(response['content']);
setTimeout(function() {
$("#custom-popup").show();
setInterval(function() {
$("#custom-popup").hide();
}, 4000);
}, 4000);
}
}
});
Try to use this code :
$.ajax({
url: BASE_URL + this.options.posturl,
type: "POST",
datatype: "json",
data: {
productId: productId
},
success: function(response) {
if (response['content']) {
$("#custom-popup").html(response['content']);
setTimeout(function() {
$("#custom-popup").show();
setInterval(function() {
$("#custom-popup").hide();
}, 4000);
}, 4000);
}
}
});
answered Jun 23 '18 at 18:55
Rohan HapaniRohan Hapani
6,11721662
6,11721662
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:04
No. It will be useful for after 4 sec hide popup. Please check in diff checker you get idea about what you want to do.
– Rohan Hapani
Jun 25 '18 at 6:07
add a comment |
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:04
No. It will be useful for after 4 sec hide popup. Please check in diff checker you get idea about what you want to do.
– Rohan Hapani
Jun 25 '18 at 6:07
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:04
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:04
No. It will be useful for after 4 sec hide popup. Please check in diff checker you get idea about what you want to do.
– Rohan Hapani
Jun 25 '18 at 6:07
No. It will be useful for after 4 sec hide popup. Please check in diff checker you get idea about what you want to do.
– Rohan Hapani
Jun 25 '18 at 6:07
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f231128%2fcustom-popup-in-magento2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
please check my answer and let me know if any query.
– Rohan Hapani
Jun 23 '18 at 18:56
Your answer is same as my question..what is the change???? @Rohan Hapani
– Mano M
Jun 25 '18 at 4:19
Remove $("#custom-popup").hide(); at success.
– Rohan Hapani
Jun 25 '18 at 4:52
Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000);
– Mano M
Jun 25 '18 at 5:03