background-position

How to do a .less mixin that generates something of a grid in css?

雨燕双飞 提交于 2019-12-14 04:00:25
问题 I want to generate a matrix of css selector in the form of .cX.rY selectors for a grid of something like 10 x 10. But I'm not seeing how I can do this less (I'm pretty new to .less). I'm using DotLess too, so perhaps there are some built-in limitations with that; I don't know for sure on that front. @col-width: -24px; @row-width: -24px; .img-pos(@col, @row) { background-position: (((@col - 1) * @col-width) - 1) (((@row - 1) * @row-width) - 1); } .c2.r1 { .img-pos(2, 1); } .c2.r2 { .img-pos(2,

CSS3 - Fade between 'background-position' of a sprite image

别等时光非礼了梦想. 提交于 2019-12-13 14:22:01
问题 I want to fade between 'background-position' of a sprite image only with CSS . I found a lot o tutorials but I didn't found something simple like this: <!doctype html> <html> <head> <meta charset="utf-8"> <title>CSS3 - Fade between 'background-position' of a sprite image</title> <style type="text/css"> div{ width: 120px; height: 60px; background-image: url('sprite.jpg'); background-repeat: no-repeat; background-position: 0 0; } div:hover{ background-position: 0 -60px; } </style> </head> <body

How to use “use-percentages” on Compass?

假如想象 提交于 2019-12-13 06:28:05
问题 I'm trying to use use_percentages to generate an image sprite with background position by percentage. But after compiling the SCSS file, the background-position declaration is still in pixels. My SASS code: @import "compass/utilities/sprites"; $sprite-layout:smart; $sprite-sprite-dimensions: true; $use-percentages: true; @import "images/sprite/*.png"; @include all-sprite-sprites; How can I get the sprite images to be positioned by percentages? 回答1: You have to include the name of your sprite

jquery - click & activate active button

混江龙づ霸主 提交于 2019-12-13 05:16:07
问题 In jQuery: Scenario ** - I have four Divs that have hover effects. - All use a jquery animation to move the backgroundPosition to show the hover state. Problem ** - I want to set a focus or clicked state, so that once you have clicked on a button it animates the background position even further to show the new state. I would also like the buttons to be aware if any other buttons have been clicked and remove the current click state and begin to animate the new click state on the new selected

background-attachment: fixed moving backwards on Chrome

混江龙づ霸主 提交于 2019-12-12 14:13:37
问题 I'm experiencing a very strange bug with background-position: fixed in Chrome (v67 on macOS) where the background image actually moves up when I scroll, rather than being fixed . Here is a codepen of the issue: https://codepen.io/alexismo/pen/xzwmRE and here is a gif of it: https://gfycat.com/PolishedHarshAfricangroundhornbill The content of the page is structured as <body> <div class="background-image"></div> <div class="rest-of-the-site"></div> </body> .background-image { width: 100%;

extension of the backgroundposition in the function animate() dosen't work in IE7 or IE8

≯℡__Kan透↙ 提交于 2019-12-11 17:39:10
问题 This code is extension created by Alexander Farkas http://bit.ly/bZzOC8 It is usefull for could used two values on the function animate() as in this example: $('div').animate({ backgroundPosition:'(0 -5500)' },330); Unfortunately this extension doesn't work when use IE7 or IE8. The next code is the backgroundPosition extension: /** * @author Alexander Farkas * v. 1.02 */ (function($) { $.extend($.fx.step,{ backgroundPosition: function(fx) { if (fx.state === 0 && typeof fx.end == 'string') {

jQuery background-position animation with css sprites not working

戏子无情 提交于 2019-12-11 10:42:52
问题 So I am trying to animate my navigation links background which is Css sprite. this picture: http://img689.imageshack.us/img689/2996/menufc.png $(document).ready(function(){ $('nav a') // On mouse over, move the background on hover .mouseover(function(){ $(this).stop().animate({backgroundPosition: '0px ' +$(this).attr('data-one')+'px';}, 500); }) // On mouse out, move the background back .mouseout(function(){ $(this).stop().animate({backgroundPosition: '0px ' +$(this).attr('data-two')+'px';},

animate backgroundPosition

不羁的心 提交于 2019-12-11 09:52:19
问题 Anyone know why the below would not work. If I just set the css directly without animate it works. //div.css( {backgroundPosition: "bottom left"} ); $("#menu li").bind("mouseover", function(){ var div=$(this).find('div'); div.css( {backgroundPosition: "bottom left"} ); div.stop().animate( {backgroundPosition: '25px 0px'}, {duration:500} ); }) .mouseout(function(){ var div=$(this).find('div'); div.stop().animate( {backgroundPosition: "0px 0px"}, {duration:500} ); }); 回答1: you have to set the

Div background change when hovering another div with jQuery

醉酒当歌 提交于 2019-12-11 07:57:23
问题 I am trying to get this working but I know very little of jQuery. When an user hovers on the div "button" the background position of the div "slide" must change from "0 0" to "0 -89px", while moving the mouse to another point must reset the background position to "0 0". That's the code (recycled from another question on stackoverflow): $(document).ready(function(){ $('#button').hover(function(){ $('#slide').css('backgroundPosition', newValue); }, function(){ $('#slide').css(

CSS/Javascript How do I make this background-position movie in Firefox like it does in IE7+?

你离开我真会死。 提交于 2019-12-11 06:15:36
问题 <script language="javascript" > var speed=25; //speed var num=0; var photos = document.getElementById('head_image'); function scrollBG() { num++; photos.style.backgroundPosition="0"+num; } setInterval('scrollBG()',speed); </script> This is the site in question: www.theorymarine.com 回答1: photos.style.backgroundPosition="0"+num; You need a unit for CSS lengths. photos.style.backgroundPosition= num+'px 0'; You might also prefer to base your animation on the time, so that the rate it moves is not