Buttons with mouse over and out function - php

Check this url please http://x2t.com/262032
You can see how does facebook button work right side of navigation menu.
This code works with this button.
CSS
div.social-wrapper {
float: right;
text-align: right;
font-size: 15px;
font-weight: bold;
margin: 11px 15px 0px 0px;
}
div.social-wrapper-text {
margin-bottom: 10px;
}
div.social-icon:first-child {
margin-left: 0px;
}
div.social-icon {
float: left;
margin-left: 11px;
opacity: 0.55;
filter: alpha(opacity=55);
cursor: pointer;
}
I need the code for two facebook buttons with mouse over and out function.
On mouse over guest will see for example white FB button and on mouse over black one.
How to do this?

<button class="class_of_button"> like us on facebook </button>
.class_of_button {
background: url('source of fb image');
}
.class_of_button:hover {
background: url('source of black fb image');
}

Here my personal solution for this:
HTML:
<div class="social-icon">
<a href="CHANGE THIS LINK TO YOUR ONE">
<img src="MOUSE_OFF.jpg"></img>
<img src="MOUSE_ON.jpg"></img>
</a>
</div>
CSS:
<style type="text/css">
div.social-icon
{
width: 600px; /* Width of IMG, TO BE CHANGED *
height: 800px; /* Height of IMG, TO BE CHANGED *
}
div.social-icon img:nth-child(2)
{
display: none;
}
div.social-icon img:first-child
{
display: block;
}
div.social-icon:hover img:nth-child(2)
{
display: block;
}
div.social-icon:hover img:first-child
{
display: none;
}
</style>
Just put the CSS into the
and the html where you would have placed your button.
And don't forget to change the mentioned values in the css and html.
And yes: You have to create the images yourself, so show yourself some Paint skillz~

Related

Display woocommerce product gallery thumbnails on one row as slider

On woocommerce single product page, the default for gallery thumbnails appears under active image in rows. Currently for me it's displaying 4 images per row.
I believe Woocommerce uses flexslider for product page slider.
So since we are going to have lots of images for each product, I'm looking to add slider navigation to the product gallery while avoiding another plugin. As a result, the product gallery will then show all images on only 1 single row.
Like flexslider2
What would be the best way to achieve this? - Can it be done with pure CSS or would one need to add slider navigation using WordPress filters and CSS?
CSS
flex-control-thumbs {
width: 90%;
position: absolute;
bottom: 0px;
text-align: center;
display:flex;
flex-wrap:nowrap;
border: 1px solid red;
overflow-x:auto;
padding-bottom:10px;
}
.flex-control-thumbs li {
margin: 0 6px;
display: inline-block;
zoom: 1;
}
.flex-control-thumbs li,
.flex-control-thumbs li:first-child {
width: 16%;
vertical-align: top;
margin: 5px 1% 0 0;
min-width: 100px;
}
.flex-control-thumbs img {
width: 100%;
display: block;
opacity: 0.8;
cursor: pointer;
}
.flex-control-thumbs img:hover {
opacity: 0.5;
}
.flex-control-thumbs .flex-active {
opacity: 1;
cursor: default;
}
.product_slider .flex-active-slide a:hover {
cursor: -webkit-zoom-in;
cursor: -moz-zoom-in;
}
Outer HTML from WC
<ol class="flex-control-nav flex-control-thumbs">
<li><img src="image.jpeg" class="flex-active" draggable="false" /></li>
<li><img src="image.jpeg" draggable="false" /></li>
<li><img src="image.jpeg" draggable="false" /></li>
<li><img src="image.jpeg" draggable="false" /></li>
<li><img src="image.jpeg" draggable="false" /></li>
<li><img src="image.jpeg" draggable="false" /></li>
</ol>
// Add slider navigation using WordPress filters.
add_filter( 'woocommerce_single_product_carousel_options', 'cuswoo_update_woo_flexslider_options' );
/**
* Filer WooCommerce Flexslider options - Add Navigation Arrows
*/
function cuswoo_update_woo_flexslider_options( $options ) {
$options['directionNav'] = true;
return $options;
}
UPDATE
Here is CSS for the Navigation controls / for the Fliter above (next & previous image).
ul.flex-direction-nav {
position: absolute;
top: 30%;
z-index: 99999;
width: 100%;
left: 0;
margin: 0;
padding: 0px;
list-style: none;}
li.flex-nav-prev {float: left;}
li.flex-nav-next {float: right;}
a.flex-next {visibility:hidden;}
a.flex-prev {visibility:hidden;}
a.flex-next::after {visibility:visible;content: '\f105';
font-family: FontAwesome;margin-right: 10px;font-size: 70px; }
a.flex-prev::before {
visibility:visible;
content: '\f104';
font-family: FontAwesome; margin-left: 10px;font-size: 70px;}
to solve this you need to add a horizontal slider if thumbnails are many, and some more CSS grid code to make it responsive and spaced properly, I hope you find this useful.
.woocommerce-product-gallery {
display: grid;
gap: 10px }
#media only screen and (max-width: 35.999em) {
.woocommerce-product-gallery {
gap: 6px;
}
}
.woocommerce-product-gallery .flex-control-thumbs {
display: grid;
grid-auto-flow: column;
grid-auto-columns: 17%;
gap: 1rem;
overflow-x: auto !important;
overscroll-behavior-inline: contain;
}
#media screen and (max-width: 47.999em) {
.woocommerce-product-gallery .flex-control-thumbs {
grid-auto-columns: 12.5%;
gap: 6px;
}
}
.woocommerce-product-gallery .flex-control-thumbs li {
float: none !important;
width: 100% !important;
display: grid;
}
.woocommerce-product-gallery .flex-control-thumbs li img {
inline-size: 100%;
aspect-ratio: 1/1;
-o-object-fit: cover;
object-fit: cover;
border-radius: 5px;
}
.woocommerce-product-gallery .flex-control-thumbs li img.flex-active {
border: 5px solid #f2f2f2;
}
#media screen and (max-width: 47.999em) {
.woocommerce-product-gallery .flex-control-thumbs li img.flex-active {
border: 2px solid #f2f2f2; }
}
.woocommerce-product-gallery .flex-control-nav {
-ms-scroll-snap-type: inline mandatory;
scroll-snap-type: inline mandatory;
scroll-padding-inline: 10px;
}
.woocommerce-product-gallery .flex-control-nav > * {
scroll-snap-align: start;
}
if you wish to also add the navigation the code is easy if need help I can assist
Cheers!

I made the Anchor tag as button and it is not working

Im trying to make the anchor tag as button and trying to add some css on it but it is not clickable
Here is my html code.
I'm following a youtube tutorial, I followed the video 100% but mine is not working, Im sorry im just new in web developing thankyou for the help.
<body>
<!-- Welcome Page -->
<section id="ulambg">
<div class="ulambg container">
<div>
<h1>Eatwell</h1>
Ready to Eat
Ready to Cook
</div>
</div>
</section>
<!-- End Welcom Page -->
And this is the css I used in the program, is it because of the Java? I read some forum that says some java function wont work if you disabled your java on your machine.
#import url('https://fonts.googleapis.com/css2?family=Raleway:wght#600&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 15px;
font-family: 'Raleway', sans-serif ;
}
a {
text-decoration: none;
}
.container {
min-height: 100vh;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
/*Welcome Page Section Ulambg*/
#ulambg {
background-image: url(./img/bg.jpg);
background-size: cover;
background-position: top center;
position: relative;
}
#ulambg::after {
content: '';
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
background-color: black;
opacity: .5;
}
#ulambg h1 {
color: white;
width: fit-content;
font-size: 4rem;
position: relative;
}
#ulambg .btnulam {
display: inline-block;
padding: 10px 30px;
color: blue;
background-color: transparent;
border: 2px solid blue;
font-size: 2rem;
text-transform: uppercase;
letter-spacing: .1rem;
margin-top: 30px;
transition: .3s ease;
transition-property: background-color;
}
#ulambg .btnulam:hover {
color: white;
background-color: blue;
}
/*Welcome Page Sectio Ulambg*/
add z-index: -1 in #ulambg::after, it's background, should not cover the page.
Demo
if i understand u correct, u mean <a href="#".. <- Anchor tag isnt clickable?
If yes u need to give it a name like <a href="#goHere".. and this means the link points to an id somewhere on the page ( for example to: <img id="goHere" src="/img/pic.gif"...
I'm new to the stuff myself but hopefully i could help in any way :)

how to make a transparent drop down button from an SVG?

I'm trying to set up a nav button system where you either hover or click on the SVG ( which is but it as a separate php) then there will be button drop dop, but more like transparent button.
text with a clear background (no box or border). how do I do this?
The Many Ways to Change an SVG Fill on Hover (and When to Use Them)
#CSS Filters
CSS filters allow us to apply a whole bunch of cool, Photoshop-esque effects right in the browser. Filters are applied to the element after the browser renders layout and initial paint, which means they fall back gracefully. They apply to the whole element, including children. Think of a filter as a lens laid over the top of the element it's applied to.
You can change the opacity with the opacity filter opacity(<number-percentage>); .
and you can put this in a hover css tag
.navbar:hover {
filter: opacity(<number-percentage>);
}
And here is how you make a dropdown navbar:
<div class="navbar">
Home
News
<div class="dropdown">
<button class="dropbtn">Dropdown
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
</div>
here is the css to the navbar:
/* Navbar container */
.navbar {
overflow: hidden;
background-color: #333;
font-family: Arial;
}
/* Links inside the navbar */
.navbar a {
float: left;
font-size: 16px;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* The dropdown container */
.dropdown {
float: left;
overflow: hidden;
}
/* Dropdown button */
.dropdown .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit; /* Important for vertical align on mobile phones */
margin: 0; /* Important for vertical align on mobile phones */
}
/* Add a red background color to navbar links on hover */
.navbar a:hover, .dropdown:hover .dropbtn {
background-color: red;
}
/* Dropdown content (hidden by default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
/* Links inside the dropdown */
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
/* Add a grey background color to dropdown links on hover */
.dropdown-content a:hover {
background-color: #ddd;
}
/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
display: block;
}

How to style a button that displays as an image

I have the following code:
#a img {
display: inline-block;
width: 14em;
margin-top: 20px;
float: left;
}
#a {
display: inline-block;
width: 14em;
margin-left: 3%;
margin-top: 20px;
float: left;
}
<button id='a' name='a' value='x'><img src='../../files/images/someimage.png' alt='text'></button>
This displays my image inside a grey box like a button. Is there a way to get ride of the grey box around it?
As I just want to display the image with the same functions as a button
Any help welcome
Something like this, you just need to remove default properties of button
#a{
background:none;
border:0;
outline:0;
}
<button id='a' name='a' value='x'><img src='../../files/images/someimage.png' alt='text'></button>
<button id='a' name='a' value='x'><img src='submit.gif' alt='text'></button>
<style>
button{
background:transparent;
border:none
}
<style>
You can specify background transparent for the button. If you want you can use input type="image" .
button {
background: url("http://placehold.it/200x50");
background-size: cover;
width: 200px;
height: 50px;
cursor: pointer;
}
button:hover {
border: thin solid red;
}
<button></button>
you can do via border:none. Just add it to your css
#a { display:inline-block; width:14em; margin-left:3%; margin-top:20px; float:left; border: none; outline: 0; background: none }
#a:focus, #a:hover { border: none; outline: 0; background: none }

jQuery slider stop dynamically at end or append li items to continue

I am trying to get a jQuery function to slide li items left and right by clicking an arrow. I am using a jQuery script called TinyCarousel.js. While I have it functioning properly, it continues to scroll right until the last li item is in the first position. What I have currently can be seen here in the "Games Currently Testing or Releasing section" under the main slider. If you scroll all the way to the right you will notice the issue.
Is it possible to either...
1) Change the jQuery to make the last li item stop once it is showing all the way on the right side of the window? I know this would have to be relative to the browser window size as well as make one single partial movement incase the window size has a partial item showing. I also know I would have to know the amount of li items which I can do within the php.
2) Or two, append the li continually so that the slider never seems to end. Just continues through repeating over and over? I would guess that I need to continually append li items as well as remove them if they are off screen.
I attempted to create a jFiddle to show the issue. But it is doing something all together different on jFiddle which is closer to what I need. It seems to stop moving right at some point. But it does not need the entire last li to display completely. What is it doing differently than what I have on the live site where it does stop?
Any help is greatly appreciated. I did search and found this but it did not seem to work in this situation. Thank you in adavnce.
I have am using jQuery 1.10.2, php 5.4, TinyCarousel.js version 1.9
Here is what I have currently.
The CSS
.PrevArrow {
width: 5%;
float: left;
margin-top: 20px;
}
.NextArrow {
width: 5%;
float: right;
margin-top: 20px;
}
.ListImage img {
margin-top: 5px;
margin-bottom: 10px;
}
#slider-code .viewport {
float: left;
width:90%;
height: 95px;
overflow: hidden;
position: relative;
margin-top: 5px;
margin-left: auto;
margin-right: auto;
}
#slider-code .buttons {
display: block;
margin: 0px 10px 0 10px;
float: left;
}
#TickHead {
margin-top: 3px;
}
#slider-code .prev {
margin: 0 10px 0 10px;
}
#slider-code .next {
margin: 0 10px 0 10px;
}
#slider-code .disable {
visibility: hidden;
}
#slider-code .overview {
list-style: none;
padding: 0;
margin: 0;
position: absolute;
left: 0;
top: 0;
}
.TestingTickerText {
vertical-align: top;
color: #666666;
font-family:'Open Sans', "lucida grande", tahoma, verdana, arial, sans-serif;
font-size: 10px;
}
#slider-code .overview li {
float: left;
margin: 0 20px 0 0;
padding: 1px;
height: 65px;
width: 105px;
left: 0;
}
#slider-code .pager {
overflow:hidden;
list-style: none;
clear: both;
margin: 0 0 0 45px;
}
#slider-code .pager li {
float: left;
}
#slider-code .pagenum {
text-decoration: none;
text-align: center;
padding: 5px;
color: #555555;
font-size: 14px;
font-weight: bold;
display: block;
}
#slider-code .active {
color: #fff;
}
The php
<div id="slider-code">
<div class="PrevArrow">
<img src="Link to Left Arrow"/>
</div>
<div class="viewport">
<ul class="overview">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
etc...
</ul>
</div>
<div class="NextArrow">
<img src="Link to Right Arrow"/>
</div>';
<center>
<span id="TickHead" class="cat_bg2">Games Currently Testing or Releasing</span>
</center>
</div>
The jQuery
(function ($) {
$(document).ready(function(){
$('#slider-code').tinycarousel({ display: 1});
});
}(jQuery));
I think the problem you're having is due to css positioning of the images. Try adjusting the margins so that they will be placed slightly further away from each other; so that when no image is appended the slider will stop and there will be no space. If thats not the issue, try this:
1:
Create a div and place all of the slider images in it.
2:
Give each arrow button a separate div and class.
3:
Use the jquery append function to dynamically add images to the slider class when a user clicks either button.
$(document).ready(function(){
$('.arrowbutton').click(function(){
$('.imageslider').append('.image');
});
});
Also, remember to give your image slider a set width in css, and set overflow to hidden. That should make sure no appended images go outside of the slider, and no scrollbars appear.

Categories