【问题标题】:Jquery Sparkle effect not workingJquery Sparkle 效果不起作用
【发布时间】:2016-06-01 04:12:11
【问题描述】:

我在 jquery 中有闪光效果,但闪光在背景上起作用,无论如何我可以在图像上而不是在背景上得到那些闪光。

这是我的代码:

(function () {
    var sparkle = new Sparkle();
    sparkle.init('.summs');
})();
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
		body{margin:0}
		article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}
		a{background:transparent}
		a:active,a:hover{outline:0}
		h1{font-size:2em;margin:.67em 0}
		img{border:0}
		svg:not(:root){overflow:hidden}
		code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}
		b,strong,optgroup{font-weight:700}
		pre,textarea{overflow:auto}

		html {
			height: 100%;
		}

		body {
			color: #AAA;
			background-color: #000;
			line-height: 1.4;
			margin: 50px;
		}

		h1 {
			color: #FFF;
		}

		h2 {
			padding: 10px 0;
			border-bottom: 1px solid #444;
		}

		a {
			color: inherit;
		}

		em {
			font-family: monospace;
			font-size: 16px;
			font-style: normal;
			background-color: #333;
			border-radius: 3px;
			padding: 3px 5px;
		}

		pre {
			color: #FFF;
			background-color: #444;
			padding: 0 25px;
			border-radius: 3px;
		}

		#wrapper {
			width: 20%;
			margin: auto;
			border:red solid 1px
		}
		div.summs {
  background: rgba(0, 0, 0, 0) url("https://custom.cvent.com/9BC2D0988F874B5C8C15E9D14B6E2F3B/pix/21abaeaeb5d94c73b6814e90cf55d240.jpg") no-repeat scroll center top;
  height: 516px;
  margin: 0 auto;
  position: relative;
  text-align: center;
  top: -40px;
  width: 1000px;
}
<script src="https://s3-us-west-1.amazonaws.com/creative-event/sparkle-effect/sparkle.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="summs">
    <div class="onslide2">
        <h1 class="bold"><strong>Sparkling Beauty&nbsp;Sparkling Service</strong></h1>
        <br>
        <br>
        <h1 class="l2">GALA DINNER<br>
            Sparkling Dior Ambassadress</h1>
        <h1 class="l3">26<sup>th</sup> May 2016<br>
            JW Marriott Hotel, Macau</h1>
        <h1 class="l4">Dress Code: Rose Gold and Champagne&nbsp;</h1>
        <h2>Remember to bring your sparkling outfit.<br>
            There will be a prize for best-dressed.</h2>
    </div>
</div>

Fiddle

很抱歉,我不知道如何将其设为此处的链接。请您复制网址并粘贴。

需要帮助

【问题讨论】:

  • 寻求调试帮助的问题必须包含重现它所需的最短代码在问题本身中。 注意 - 请不要滥用代码块来解决这个问题要求.

标签: javascript jquery html css


【解决方案1】:

这是我自己创建的。如果你在某个地方给我学分,如果你使用它,那就太好了。但是,嘿,你做你想做的。

https://jsfiddle.net/virginieLGB/mL6uf3xm/5/

你唯一需要改变的是

mySparkle.init( $( ".summs" ) , 150 );

我想你会想在这里保留元素,但你可以用你想要的任意数量的星来更改“150”。

玩得开心

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-06-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多