Javascript 模式窗口代码重新配置为在页面加载时加载而不是在单击时加载。帮助 :)
我有一个 js 模式窗口,它在我网站的页面中通过 onclick 函数打开:
<a class="highslide" onclick="return hs.expand(this, { slideshowGroup: 'groupC0', wrapperClassName: 'wide-border', outlineType : 'rounded-white', dimmingOpacity: 0.8, align : 'center', transitions : ['expand', 'crossfade'], fadeInOut: true });" href="/images/phocagallery/thumbs/phoca_thumb_l_jen raymond_067 copy.jpg" title="jen raymond_067 copy">
<img alt="jen raymond_067 copy" src="/images/phocagallery/thumbs/phoca_thumb_m_jen raymond_067 copy.jpg">
</a>
我需要在页面加载时触发此窗口(不是 onclick,如上所述)。我一直在玩这个js,
<script type="text/javascript">
$(document).ready(function() {
window.location.href = "/images/phocagallery/thumbs/phoca_thumb_l_jen raymond_067 copy.jpg";
});
</script>
但当然它只加载图像(href) - 你能帮助将类、标题和onclick属性包含到这个js函数中 - 或者有更好的方法吗?
请让我看到光:)
I have a js modal window which opens with an onclick function in a page on my site:
<a class="highslide" onclick="return hs.expand(this, { slideshowGroup: 'groupC0', wrapperClassName: 'wide-border', outlineType : 'rounded-white', dimmingOpacity: 0.8, align : 'center', transitions : ['expand', 'crossfade'], fadeInOut: true });" href="/images/phocagallery/thumbs/phoca_thumb_l_jen raymond_067 copy.jpg" title="jen raymond_067 copy">
<img alt="jen raymond_067 copy" src="/images/phocagallery/thumbs/phoca_thumb_m_jen raymond_067 copy.jpg">
</a>
I need this triggered as the page loads (not onclick, as above). I've been playing around with this js
<script type="text/javascript">
$(document).ready(function() {
window.location.href = "/images/phocagallery/thumbs/phoca_thumb_l_jen raymond_067 copy.jpg";
});
</script>
But of course it only loads the image (href) - can you help include the class, title and onclick attributes to this js function - or is there a better way?
Please show me the light :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试以下操作(请记住,我不知道这个函数的作用):
这是我在不查找 hs(highlide?) api 的情况下能想到的最好的方法。
You can try the following (keeping in mind I have no idea what this function does):
Thats the best I can come up with without looking up the hs(highlide?) api.
试试这个:
Try this:
感谢上面的解决方案,也许我只是不了解JS,但我看不到我的使用方式,但是我确实使用这种方法得到了我想要的:
1)向锚标记添加ID
2)加载JQuery 如果尚不存在
3) 添加此函数
Thanks for the solutions above, maybe I'm just not knowledgable with JS, but I couldn't see my way using either, however I did get what I wanted using this method:
1) Add an ID to the Anchor tag
2) Load JQuery if not already present
3) Add this function