How to show a semi transparent overlay with button (!) on an image? - javascript

i am using ASP.Net to edit an image. I would like to have onMouseOver an semi transparent overlay on my image which show me some button. One important thing is, that some of these buttons are role-based so that i must be able from code behind to set those button visible/innvisible. How could i do this?

Related

how can i make this image slider show an image without having to press the dots or buttons? it only shows arrows and dots first

I got this source code from "https://www.w3schools.com/howto/howto_js_slideshow.asp" and when it first shows after each time I click refresh on the page, only the dots and arrows appear, so I was wondering how I can make it so it appears on an image first hand.
When you first add the code to a text editor and link all the HTML, CSS, JS, and open it in the browser, all you get is the arrows and the dots. After you click on either of those the image appears and it works nicely. But after each refresh the same problems appears Just want it to make it so the image appears automatically.
Thanks everyone for your help!

Javascript - Get the average colours of pixels in a square

So I currently have a transparent web page (all the elements are visible but the background is transparent - I am using a software to do this and the background is completely transparent and can be clicked through).
What I need to do is to be able to move a box to select a specific part of the web page and then for the box to detect the colour that is behind the window (as the background is transparent)?
This picture should make a little more sense of it; the red is, for example, a desktop background. This window would be opened and the box moved to be able to detect the colour.
The idea would be like this: http://lokeshdhakar.com/projects/color-thief/ but I need it to work on a transparent window and not an image which I am unsure is possible with HTML and JS?
I understand it is possible to use an image but I would need this to continuously check the colour and when there is a change, update quickly.
Thanks for any help!

In Video.js, where can I change the big play button color when the mouse is hovering over the video?

Using the video.js default skin editor (CodePen), I successfully changed the SCSS $primary-background-color to a shade of orange (specifically #f60), which generated CSS to give the background of the control bar components and the big play button variations of orange.
This works fine, but when I move the mouse cursor over the video, the big play button background changes to grayish blue (the default), and then back to orange when the mouse is not over the video. I'd prefer to have the big play button remain orange whenever it is displayed, no matter where the mouse is.
I hunted around in the CSS/SCSS in the default skin editor, but can't see what is controlling the background color of the big play button when the mouse is over the video. I'm sure I'm missing something, or perhaps this is controlled in another part of the CSS/SCSS or JS that is not exposed in the video.js default skin editor.
I tried adding the following to my CSS:
.video-js .vjs-big-play-button:hover {
background-color: rgba(255, 102, 0, 0.7);
}
and that gives me an orange big play button when I'm hovering over the button itself. But I would like the button to remain orange as the mouse travels over the video before it gets to the button (i.e., I want the button to remain orange all the time).
So, there are three cases, two of which work and one that I'm trying to get working:
When the mouse is completely outside the video.js player area, the big play button has the right color (handled by the custom skin CSS).
When the mouse is hovering over the big play button itself, the button has the right color (handled by the hover rule shown above).
When the mouse is hovering inside the video.js player area, but is not hovering directly over the big play button, the button has the default color, not the color I want it to have. This is the part I'm having trouble with.
What do I need to change/override to ensure the big play button will stay orange even while the user hovers the mouse over the video (and not over the button itself)? Thanks.
The pen is missing the secondary background colour and hover state styles
$secondary-background-color: lighten($primary-background-color, 33%) !default;
.video-js:hover .vjs-control-bar,
.video-js:hover .vjs-big-play-button,
.video-js:hover .vjs-menu-button .vjs-menu-content {
background-color: $secondary-background-color;
background-color: rgba($secondary-background-color, 0.7);
}
Here's an updated codepen

Check if image background is white using Javascript

im creating a way for users to add some buttons to their image. Now i thought it would be cool if the button could change color depending of the background color of the image.
To start with i wanted to go for the black / white contrast.
So if the background is white then the button will be black and if the background color is black then the button should be white.
My question is however is it possible to identify the background of an image using only javascript? and if so how?
This will take care of everything for you just set up the selectors for each condition.
https://github.com/kennethcachia/Background-Check

Flash-looking animated banner with JQuery

I am trying to create a banner for the top of page, but haven't found any code yet that combines all of what I need. I have included an illustration of what I'm trying to do.
A) I have 4 buttons (each an image file), two to either side default image in the center. This is the main/inactive state.
All of the buttons would have similar animation when hovered over. For the sake of this question, I only illustrated two of the buttons.
B) If you hover over Box 1 (top left), the button would change and text and lines would slide out from left to right. Also, the center image would change. And, to make things extra challenging, the left button and center image would link to Page 1. When you move away, the text slides back to the left, and the image returns to the default state in A. The blue box would behave the same way, linking to Page 2.
C) In a similar manner, if you hover over Box 4 (bottom right), the button would change and text and lines would slide out from right to left. Also, the center image would change. The right button and center image would link to Page 4. When you move away, the text slides back to the right, and the image returns to the default state in A. The green box would behave in the same manner, linking to Page 3.
The closest I've found is this: jQuery image slide on hover effect (horizontal) I was thinking that if I used the static images of all (A) as a background image, maybe I could create a transparent sprite, with only the active version of the hovered button and the center image, to slide left or right on hover.
I can see how the above example might would work for Boxes 1 and 3 (top left and right) and give the illusion of the lines sliding out as the image slides either left or right, but I'm not sure how it would work for Boxes 2 and 4.
Am I on the right track, or am I asking for way more than what's possible in JQuery? I'd be fine with loosing the animated text (I could just make them part of the hover images), but the buttons and center image need to change on hover, and they need to link to a page.
I've made a widget in jQuery that was confused with flash before. I think you need to breakdown each element of your widget into discrete pieces. You are making a new widget. There will be no methods doing what you want. You will have to use the .animate() method explained here. http://api.jquery.com/animate/ You will be animating one CSS class to another CSS class using the .animate() method.
This page has a good primer on the animate method.
http://viralpatel.net/blogs/2010/03/understanding-jquery-animate-function.html
Here's what I would do:
I would make the HTML of the page you want.
I would create CSS of each style of box that you will have.
I would have all the same CSS directives on every box that will
animate. I have found the animate method more agreeable if all CSS
that is to be computed has the same parameters but with different
values.
I would use full resolution images in the 4 outer boxes.
I would animate the div containing the image, not the image itself.
I would make the image fill the div dynamically so that when I
changed the size of the div the image would be a gimmie.
I would work in firebug testing out different commands and see how
they behave. This is critical. The interactive javascript console
is your friend.
This is a big task... when you're done this will be a nice feather in your cap! Maybe after that you could turn it into a jQuery plugin for others to use!
I decided to mess around with this for a bit, here is what I whipped up so far. No links as yet, but for a half hour I don't feel too bad about that :)
http://jsfiddle.net/BH8s5/3/

Categories