How to make an exactly menu bar like ministersofdesign.com? [closed] - menu

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
is there a way to make an exactly menubar like website www.ministersofdesign.com?
If I hover on a menu the fonts turn red, or if I scroll down to a section the menu automatically turns red font too.
Thank you so much !

You've to use the ScrollTop jQuery property. And to detect what option of the menu you've to selected for each ScrollTop value, you can do that with a simple if:
Javascript
if ($(window).scrollTop() < 280) {
$("#btn1").css({'background-color':'#ccc'});
$("#btn2").css({'background-color':'#fff'});
$("#btn3").css({'background-color':'#fff'});
$("#c1").css({'border-color':'#000'});
$("#c2").css({'border-color':'#ccc'});
$("#c3").css({'border-color':'#ccc'});
}
if (($(window).scrollTop() > 280) && ($(window).scrollTop() < 450)) {
$("#btn2").css({'background-color':'#ccc'});
$("#btn1").css({'background-color':'#fff'});
$("#btn3").css({'background-color':'#fff'});
$("#c2").css({'border-color':'#000'});
$("#c1").css({'border-color':'#ccc'});
$("#c3").css({'border-color':'#ccc'});
}
if ($(window).scrollTop() > 450) {
$("#btn3").css({'background-color':'#ccc'});
$("#btn2").css({'background-color':'#fff'});
$("#btn1").css({'background-color':'#fff'});
$("#c3").css({'border-color':'#000'});
$("#c1").css({'border-color':'#ccc'});
$("#c2").css({'border-color':'#ccc'});
}
Here i have a litte test I've done with jsFiddle :)

Related

Random meme generator discord.js, glitch.com, node.js [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am new to discord.js coding, I have been trying to make a meme generator, any can help me?
You can use npm packages to generate memes.
for this command idea, I will use "random-discord"
First of all , install random-discord by using npm i random-discord random-discord Docs
and create new random-discord app with :
const { Random } = require('random-discord')
const random = new Random
finally, Add this code to your bot main file :
client.on('message', message => {
if(message.content.toLowerCase() === "meme") {
let meme = await random.getMeme()
message.channel.send(meme)
}
})

How to get a firebase's database keys and values [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm new to firebase, and I'm doing a database for my discord.js bot. I know how to do almost everything, except i don't know how to get all the db data. Let me explain:
My database structure looks like this:
database structure
And i would like that when executing the showconfig command, it shows something like this:
announcementsChannel: "news",
autoRole: "false",
autoRoleName: "none",
// etc...
Is there any way to get every key and its value, and putting it all inside a message?
db.collection("users").get().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
console.log(`${doc.id} => ${doc.data()}`);
});
});
You can read the docs online at this link : https://firebase.google.com/docs/firestore/quickstart

Uncaught ReferenceError: require is not defined in Electron [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am trying and failing to connect to a MySQL database in Electron. When I run the program with npm start, I get this error in the console:
I was told to make changes to my code and I made them but nothing. I downloaded that module called bundlee but it didn't work either and I don't know if I used it correctly.
It is likely that nodeIntegration is set to false (which is the default) in your BrowserWindow webPreferences.
Try setting up your browser window with something like this:
win = new BrowserWindow({ width: 800, height: 600,
webPreferences: {
nodeIntegration: true
}
})

How to add a cookie to existing cookies in MechanicalSoup [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I know MechanicalSoup has a function called set_cookiejar() but it replaces the current cookiejar completely. I want to know how to add new cookies to existing cookies.
You can achieve it like this
import mechanicalsoup
browser = mechanicalsoup.StatefulBrowser()
browser.open("your website")
cookie_obj = requests.cookies.create_cookie(name='cookie name', value='cookie value', domain='domain name')
browser.session.cookies.set_cookie(cookie_obj) # This will add your new cookie to existing cookies
Another way to do it is
import mechanicalsoup
browser = mechanicalsoup.StatefulBrowser()
browser.open("your website")
new_cookie = {
"name":'COOKIE_NAME',
"value":'true',
"version":0,
"port":None,
# "port_specified":False,
"domain":'www.mydomain.com',
# "domain_specified":False,
# "domain_initial_dot":False,
"path":'/',
# "path_specified":True,
"secure":False,
"expires":None,
"discard":True,
"comment":None,
"comment_url":None,
"rest":{},
"rfc2109":False
}
browser.session.cookies.set(**new_cookie) # This will add your new cookie to existing cookies
Source: How to add a cookie to the cookiejar in python requests library

What does underscore wrap function do? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Looking at the example given here (http://underscorejs.org/#wrap), I don't really understand what wrap is doing ... Even more so, when the function is "wrapped" it feels the parameters have to be set (for example, what about doing hello('john')? Are there other examples available that explains what wrap is all about? What would be a typical use case for it?
Thanks!
C
_.wrap() can accept more parameters in callback function other than the function you have. For example to make your hello('John') example work we need some modification on the example code to be
var hello = function(name) { return "hello: " + name; };
hello = _.wrap(hello, function(func,name) {
return "before, " + func(name) + ", after";
});
hello('John');

Resources