How to set viewed icon on click of a link in meteor. I have a list jobs page and when user clicks on one job it is going to the description page and what I want is display an icon on the post which tells user that he or she viewed the post.
Try to use this:
Template.yourTemplate.events({
'click .viewed'(event, instance) {
event.preventDefault();
instance.$('youriconReference').show();
},
});
Related
I try to made a terms and condition modal next to my register form on my wix website.
enter image description here
I have two custom dialogs #lightbox1 & #lightbox2. After user clicks REGISTER NOW (#button2) on #lightbox1 another custom popup dialog (#lightbox2) with some text and OK button should be shown. After user clicks ACCEPTER on this popup, the register should be confirmed.
That is the code i added :
$w.onReady(() => {
$w('#button2').on('click', function () {
$w("#lightbox2").show();
});
});
The problem is not recognize #lightbox2 and it throws me error :
"An element with the ID '#lightbox2' does not exist on this page. Select another element and view or edit its ID in the Properties & Events panel."
enter image description here
enter image description here
Then, if a charitable soul wants to help me, I'll welcome him with open arms 😂.
Wix only allows one lightbox at a time to function, as an alternative approach you can add Wix Multi-State component inside the lightbox popup and switch the views with the help of code
Wix Velo Tutorial for Multi-State Boxes
Configured our app to support Add to home screen option, to ask for permission we added one button, onclick the prompt will ask to add the icon in home screen. If the user keep clicking close, then it wont ask further, so the button becomes non-functional.
If the user already added icon, i didn't get any method to find it.
There isn't any method best known to me to capture whether the app icon has been added to home screen or not. Simple reason for that could be absence of any valid existing use case. However, what you can capture is the action taken by the user. When the A2HS banner is shown, you can tap into the beforeinstallprompt event to determine the choice made by the user when presented with the banner.
The code below shows this in action:
window.addEventListener('beforeinstallprompt', function(event) {
event.userChoice.then(function(result) {
if(result.outcome == 'dismissed') {
// User dismissed
}
else {
// User accepted
}
});
});
UPDATE:
While going through the official doc for A2HS, found a way to determine if the app was successfully added to the users home screen after they accepted the prompt, you can listen for the appinstalled event. Code:
window.addEventListener('appinstalled', (evt) => {
app.logEvent('a2hs', 'installed');
});
appinstalled does not work
window.addEventListener('appinstalled', (evt) => {
app.logEvent('a2hs', 'installed');
});
I am working on a web app using AngularJs as front-end and Laravel as back-end
In many views I have sharing bar with tweet button, I managed to add a share button using twitter javascript widget
twttr.widgets.createShareButton(
'https://dev.twitter.com/',
document.getElementById('tw'),
{
count: 'none',
text: 'Sharing a URL using the Tweet Button'
}
).then(function (el) {
console.log("Button created.", el);
});
and also I managed to detect the click event on this twitter share button via
twttr.events.bind(
'tweet',
function (event) {
console.log('tweeet', event);
}
);
but this event fires if user clicked on tweet button even if he just closed the popup and didn't tweet !!
I found this thread https://twittercommunity.com/t/need-to-check-if-user-tweet-like-retweet-post-successfully-using-js-intent/61432 on twitter community but it has been since Feb,2015 I hope there is something new after more than one year !
Is there anyway to track a complete successful tweet!!
Thanks in advance.
Firstly: I ma very new in jQuery and web front-end.
Problem:
I have a test site
Steps to see the problem:
Click on [UploadTest]
Click on any pic in gallery to see an overlay
Click on browser's Back button
Now I see main page with the overlay.
Question is how to hide overlay when I leave the gallery page by Back button?
Sometime othe overlay is hidden but when I go on gallery page again it is visible.
How to hide it automatically?
Thanks.
UPDATE: Sorry, I can not post sources because I do not know where is problem. Please if you have a minute look inside sources in browser.
$(document).ready(function () {
if (window.history && window.history.pushState) {
$(window).on('popstate', function () {
$("#galleryOverlay").css('display', 'none')
});
}
});
I'm using WordPress Liveblog and a not-yet merged pull-request so will reference the code directly on the GitHub repo to hopefully explain my question better. Please see here for a working example of the plugin code in action.
The WordPress comment form is shown when I click on the Reply button. Before clicking the button, the form is hidden from view.
The comments are shown when I click on the second reply button > Reply
My aim is to replace both buttons with one single button called Toggle. When clicked, I'd like both the WordPress comment form AND the comments to be displayed.
So far I have done the following...
My Toggle button:
<a class="toggle" href="#">Toggle</a>
My script (modified from here):
jQuery('a.toggle').click(function () {
var openImgUrl = 'open.png',
closeImgUrl = 'close.png';
var $newsItem = jQuery(this).closest('.news-text'),
$newsContent = $newsItem.find('.news-content'),
isContentVisible = ($newsContent.is(':visible'));
// slide up all shown news-items - but its expected that only one is visible at a time
jQuery('.news-text').find('.news-content').slideUp(function () {
// on animation callback change the img
jQuery('.news-text').find('.toggle > img').attr('src', openImgUrl);
});
if (!isContentVisible) { // if the new-item was hidden when clicked, then show it!
$newsContent.slideDown(function () {
// on animation callback change the img
$newsItem.find('.toggle > img').attr('src', closeImgUrl);
});
}
return false; // stop postback
});
Using my script and toggle button, when the Toggle button is clicked, comments are displayed under each entry. When the toggle button is clicked again, the comments are hidden. However, this doesn't take the WordPress comment form into account.
How can I get the WordPress comment form to display along with the comments when the Toggle button is clicked?
Liveblog Glossary:
Entry: An entry is a top-level comment just like a standard 'comment' made in WordPress.
Comment: Comments can be made on entries.
I found comment_reply_link to be the answer!
http://codex.wordpress.org/Function_Reference/comment_reply_link
Using this function to output the reply link enabled me to do what I needed. I just had to change my selector in my script to use the comment reply button as the toggle and remove the original toggle button I had set up. For example:
jQuery('a.comment-reply-link').click(function () {