Tôi cần khi tôi nhấp vào bất kỳ thứ gì sử dụng fancybox, nó sẽ tạo một URL cụ thể cho điều đó, vì vậy khi tôi gửi liên kết này tới ai đó, nó sẽ mở hộp cụ thể mà tôi muốn.Làm thế nào để tạo liên kết trực tiếp đến bất kỳ hộp fancybox
Ví dụ: fancybox.net/home khi tôi nhấp vào hình ảnh đầu tiên, liên kết vẫn fancybox.net/home Tôi muốn rằng khi tôi nhấp vào hình ảnh, URL được tạo ra và xuất hiện trong thanh địa chỉ như: fancybox.net/home/imageid=1 nên khi tôi gửi fancybox.net/home/imageid=1 với ai đó nó đã mở hình ảnh trong hộp
Cảm ơn!
(Nó giống như hình ảnh facebook, khi bạn nhấp chuột vào bất kỳ hình ảnh, bức ảnh sẽ mở trong một hộp nhưng những thay đổi thanh địa chỉ để liên kết hình ảnh)
////// CẬP NHẬT # 1 //////
Tôi đã làm những gì JFK đề xuất nhưng sau một giờ thử tôi vẫn không biết tại sao các hộp không giống nhau.
Nhìn diference giữa:
mã:
<script type="text/javascript">
var thisHash = window.location.hash;
$(document).ready(function() {
if(window.location.hash) {
$(thisHash).fancybox({
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
arrows : true,
nextClick : true,
helpers : {
thumbs : {
width : 80,
height : 80
},
title : {
type : 'inside'
},
buttons : {}
},
afterLoad : function() {
this.title = (this.index + 1) + ' de ' + this.group.length + '<div id="curti"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.google.com.br&send=true&layout=standard&width=45&show_faces=false&action=like&colorscheme=light&font&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:56px; height:24px;" allowTransparency="true"></iframe></div>';
}
}).trigger('click');
}
$('.fancylink').fancybox({
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
arrows : true,
nextClick : true,
helpers : {
thumbs : {
width : 80,
height : 80
},
title : {
type : 'inside'
},
buttons : {}
},
afterLoad : function() {
this.title = (this.index + 1) + ' de ' + this.group.length + '<div id="curti"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.google.com.br&send=true&layout=standard&width=45&show_faces=false&action=like&colorscheme=light&font&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:56px; height:24px;" allowTransparency="true"></iframe></div>';
}
});
}); // ready
</script>
Có gì sai trong kịch bản đó?
Gọi 'click() 'trên liên kết kích hoạt nó. – alex
Tôi là người mới, tôi có thể làm như thế nào? –