top of page
Forum Posts
Raphaela Katz
Apr 08, 2023
In Coding with Velo
I am trying to set the header section background of blog post depending on the size of the cover image. I am using the following code: async function initPage() {
const currentPost = await $w("#post1").getPost();
if (currentPost.coverImage.width >= 980 && currentPost.coverImage.height >= 550 && currentPost.coverImage.width/currentPost.coverImage.height > 1) {
$w('#postHeaderSection').expand();
$w('#postHeaderSection').background.src = currentPost.coverImage.replace(/#[\s\S]*/, "");
$w("#postTitle").text = currentPost.title;
} else if (currentPost.coverImage.width >= 491 && currentPost.coverImage.height >= 660 && currentPost.coverImage.width/currentPost.coverImage.height <= 1) {
$w('#secondPostHeaderSection').expand();
$w('#postHeaderSquare').background.src = currentPost.coverImage.replace(/#[\s\S]*/, "");
$w('#secondPostTitle').text = currentPost.title;
} else {
$w("#titleBox").expand();
}
} However, the code doesn't seem to work and I'm not sure what could be causing the issue. I noticed that when I log currentPost.coverImage, it returns a string that starts with ("wix:image://v1/nsplsh_d0b1c2e1e12e4eeba81adec5c8605175~mv2.jpg/nsplsh_d0b1c2e1e12e4eeba81adec5c8605175~mv2.jpg#originWidth=4000&originHeight=6000" ) instead of an actual image object. Could this be the reason why the image size check is not working as expected?
I've also tried using a simpler version of the code, which works: async function initPage() {
const currentPost = await $w("#post1").getPost();
$w("#postTitle").text = currentPost.title;
$w("#postHeaderSection").background.src = currentPost.coverImage;
} If so, how can I properly access the image object to check its size? Any help would be greatly appreciated. Thank you!
0
0
7
Raphaela Katz
Apr 02, 2023
In Coding with Velo
I want to create a product page with a layout different from the one provided by Wix, but I can't load the product on the page. At first, I used a regular page, but it would be too difficult for me to manipulate the product URL path {Slug}. I'm just a designer who knows a little bit of code. So I decided to convert the page to a dynamic one, using the data set to load the product name and description, and the code to load the rest of the product information. However, only the information from the data set is being loaded, the code does not show any error message in the console, but it doesn't work either. This is the code snippet where the product information is being loaded.
I've tried to find examples on the Velo site, on the internet, and even here on the forum, but nothing worked. So I created this topic.
This is the code file, and I thought it would be better to provide the link rather than post a part of it because I don't know where the error is. The code is on GitHub Gist.
https://gist.github.com/RaphaK/fe7fed7dddd0f78e1391e6d407ace79b
0
1
28
Raphaela Katz
Mar 21, 2023
In Velo Pro Discussion
Dear Wix Velo Team, I hope this message finds you well. I am writing to propose the creation of a comprehensive programming school focused on teaching Wix Velo to individuals from all backgrounds, particularly those in countries where learning programming can be a life-changing opportunity, such as Brazil. Currently, the resources available on Wix Velo include scattered examples and three basic lessons. While these resources are helpful, they do not provide the necessary foundation for someone who wishes to truly master programming with Wix Velo. By developing a complete and in-depth programming school, Wix Velo can empower aspiring programmers with the skills and knowledge they need to succeed in the tech industry. Furthermore, I propose that the completion of the Wix Velo Programming School be linked to the Wix Partners program. This connection would create a mutually beneficial network where Wix gains loyal partners promoting its products and services, and graduates from the programming school gain access to professional opportunities, support, and recognition. The establishment of a comprehensive Wix Velo Programming School would have numerous advantages, including: Empowering individuals with the skills needed to transform their lives and overcome challenging socioeconomic conditions. Creating a pool of knowledgeable and loyal Wix Velo experts to strengthen the Wix ecosystem and improve the overall quality of Wix-powered websites. Contributing to the development of local tech communities and fostering a culture of innovation and entrepreneurship. Enhancing the reputation of Wix as a socially responsible company committed to giving back to the community. By investing in the creation of a comprehensive Wix Velo Programming School, Wix would not only be providing valuable education to aspiring programmers but also playing a pivotal role in transforming lives and communities. I urge you to consider this proposal and look forward to discussing how we can make this vision a reality. Thank you for your time and consideration. Sincerely,
1
4
105
Raphaela Katz
Jun 25, 2018
In Coding with Velo
I need to create a review for products but I'm having trouble getting the product and populate the database with the product and review information, and then load the database information on the product page. Could someone help me write this code?
0
15
390
Raphaela Katz
Jun 16, 2018
In Coding with Velo
I wanted some page objects to load async I used this piece of code, however when the page loads where it should contain the object it goes blank. Could someone help me? $w.onReady(function () {
loadObjects();
});
async function loadObjects() {
$w('columnStrip4').expand;
$w('columnStrip3').expand; }
0
3
59
Raphaela Katz
Jun 14, 2018
In Coding with Velo
I spent the day working on the Wix Code, I created the wish list, related products but I grabbed trying to set up the review, I tried, I made all the changes until my brain toasting. Could someone from the Wix team help me? This is the product page code. Here it does not open lightbox and does not show messages on the page. As I can not get the product ID so I can not check if the form will upload the review and I did not forget to call the window, nor the data base just did not put it here because I just managed to paste the piece I used the elements of the site, the rest I had to cut because it got big and I was not able to post export function addReview_onClick(event) {
let productId = $w('#productPage').getProduct();
wixWindow.openLightbox('Resenhas', {id: productId});
}
function loadReviews(limit) {
let productReview = $w('#productPage').getProduct();
wixData.query('reviews')
.eq('productId', productReview._id)
.find()
.then(res => {
if (res.length > 0) {
renderRating(res.items);
renderReviews(res.items, limit);
$w('#numberOfReviews').text = `${res.length} Reviews`;
$w('#numberOfReviews').show();
if (res.length > 2) {
$w('#seeAllReviews').show();
$w('#seeAllLine').show();
}
}
else {
$w('#rating').hide();
$w('#numberOfReviews').text = 'Este produto ainda não fio avaliado seja o primeiro.';
$w('#numberOfReviews').show();
}
});
}
let rating = Math.round(stats.sum * 2 / stats.count) / 2;
$w('#rating').show();
// setting the rating as HTML to have fine grained control over the formatting
$w('#rating').html = `<p style="font-size:15px; line-height:1.2em; text-align:center"><span
if (odd.length > 0) {
let oddRendered = odd.map(renderReview).join(reviewSeparator) + reviewEnd;
$w('#reviewsOdd').html = oddRendered;
$w('#reviewsOdd').show();
$w('#oddReviewContainer').show();
}
else {
$w('#reviewsOdd').hide();
$w('#oddReviewContainer').hide();
}
if (even.length > 0) {
let evenRendered = even.map(renderReview).join(reviewSeparator) + reviewEnd;
$w('#reviewsEven').html = evenRendered;
$w('#reviewsEven').show();
$w('#evenReviewContainer').show();
}
else {
$w('#reviewsEven').hide();
$w('#evenReviewContainer').hide();
}
}
async function seeAllReviews_onClick(event) {
loadReviews();
}
1
0
129
Raphaela Katz
Jun 14, 2018
In Coding with Velo
Is it possible to work with breadcrumbs with wix code? If it is possible someone could help me with this piece of code so that it works in wixcode. I'm not getting adptar with the wixcode elements needed for it to work. var breadcrumb={main:[{"text":'Main',"link":'/','class':'active'}],element:'ol',class:'breadcrumb',lastClass:'current-bread',exclude:['#',''],write:true,build:function(){var currentUrl=location.href.split('/').slice(3);var breads=[];var output='';for(var i=0;i<this.main.length;i++){var text=this.main[i].text;var link=this.main[i].link;var cls=this.main[i].class;breads.push({"text":text,"link":link,'class':cls});}for(var i=0;i<currentUrl.length;i++){var text=currentUrl[i];text=text[0].toUpperCase()+text.substring(1);var link='/'+currentUrl.slice(0,i+1).join('/');breads.push({"text":text,"link":link,'class':' '});}output+='<'+this.element+' class="'+this.class+'">';var breadLen=breads.length;for(var j=0;j<breadLen-1;j++){if(this.exclude.indexOf(breads[j].text)==-1){output+='<li class="'+breads[j].class+'"><a href="'+breads[j].link+'">'+breads[j].text+'</a></li>';}}output+='<li class="'+this.lastClass+'"><a href="'+breads[breadLen-1].link+'">'+breads[breadLen-1].text+'</a></li>';output+='</'+this.element+'>';if(this.write==true){document.write(output);}return output;}};
0
4
1k
Raphaela Katz
Jun 06, 2018
In Coding with Velo
How can I connect the input text box with the rich text field? Which input box can I work with rich text? I wanted to create a form where the owner of the site could update his articles in the database.
0
2
58
Raphaela Katz
Jun 02, 2018
In Coding with Velo
I want to create a menu that moves with the scroll of the window I put up this piece of code, in the code window does not acknowledge any error but when I go to preview mode the menu does not change its behavior. I used the wix site header with #navbar. import wixWindow from 'wix-window'
var prevScrollpos = wixWindow.pageYOffset;
wixWindow.onscroll = function() {
var currentScrollPos = wixWindow.pageYOffset;
if (prevScrollpos > currentScrollPos) {
$w("#navbar").style.top = "0";
} else {
$w("#navbar").style.top = "-50px";
}
prevScrollpos = currentScrollPos;
}
0
2
371
Raphaela Katz
Feb 01, 2018
In Coding with Velo
Hello, I need to trigger the preload function on the wix site, so that when anyone accesses a page a slide appears with a promotion and the phrase LOADING, instead of the blank page. For many this page blank while the website loads may seem like a bug and they end up leaving the page. I have the code below but I can only make it work after the page has loaded I wanted to make it work while the page loads. I looked in the API library but did not find anything, if someone could help me complete the code I thank you very much. $w.onReady(() => { setTimeout(() => { showPreloader(); }, 1000); }); Here was the code with the page elements as slide function hidePreloader() { $w("#fadeContainer").hide('FadeOut'); $w("#slideshow").hide('FadeOut').then(() => { }); } function showPreloader() { $w("#slideshow").changeSlide(0) .then(() => { $w("#fadeContainer").show('FadeIn'); $w("#slideshow").show('FadeIn') .then(() => { playSlideshow(); }); }); } function playSlideshow() { setTimeout(toSlideN(1), 1500); function toSlideN(index) { return function() { if (index >= 3) { hidePreloader(); } else { $w('#slideshow').changeSlide(index); setTimeout(toSlideN(index+1), 2500); } }; } }
0
12
8k
Raphaela Katz
Jan 02, 2018
In Coding with Velo
Hello, I would like to know when the new updates will be released Code embed, members area, ecommerce Api's? Thanks
0
6
133
Raphaela Katz
Oct 06, 2017
In Coding with Velo
Hello, Could anyone help me to make this script acceptable by WixCode, I cann't quite understand what I should change. @media screen and (max-width: 600px) { .topnav a:not(:first-child) {display: none;} .topnav a.icon { float: right; display: block; } } @media screen and (max-width: 600px) { .topnav.responsive {position: relative;} .topnav.responsive a.icon { position: absolute; right: 0; top: 0; } .topnav.responsive a { float: none; display: block; text-align: left; } } function myFunction() { var x = document.getElementById("mytopnav"); if (x.className === "topnav") { x.className += " responsive"; } else { x.className = "topnav"; } }
0
6
109
Raphaela Katz
More actions
bottom of page