/* ミニサムネイル表示javascript */ 'use strict'; // aリンクにミニサムネイルを関連付け $(function(){ if ($(window).width() < 768) { return false; } $('#miniThumbnail') .mouseover(function(event){ opnMiniThumbnail( this.href, event ); }) .mouseout(function(event){ clsMiniThumbnail(); }); // unusedクラスが指定されていればリンクしない $('#cntMainFrame a:not(.unused a)').not('.unused') .mouseover(function(event){ opnMiniThumbnail( this.href, event ); }) .mouseout(function(event){ clsMiniThumbnail(); }); }); // ミニサムネイオープン関数 function opnMiniThumbnail( strUrl, event ) { // ブラウザを取得 var strUA = navigator.userAgent.toLowerCase(); if( strUrl != null ){ // ミニサムネイルを更新 $('#miniThumLink').attr('href', strUrl); $('#miniThumbnail').attr('src', 'http://capture.heartrails.com/200x300/shorten?' + strUrl); // ブラウザごとの位置取得 var xPos = '0px'; var yPos = '0px'; if( (strUA.indexOf("firefox") != -1) || (strUA.indexOf("netscape") != -1) ){ if( event != null ){ var $body = $('html'); xPos = event.pageX - $body.scrollLeft() + 'px'; yPos = event.pageY - $body.scrollTop() + 'px'; } } else if( (strUA.indexOf("safari") != -1) ){ if( event != null ){ var $body = $('body'); xPos = event.pageX - $body.scrollLeft() + 'px'; yPos = event.pageY - $body.scrollTop() + 'px'; } } else { // デフォルト(msie, Opera, etc) var $body = $('html'); var xPos = event.pageX - $body.scrollLeft() + 'px'; var yPos = event.pageY - $body.scrollTop() + 'px'; } // 位置調整 $('#miniThumLink') .css({ left: xPos, top: yPos }); } // 表示 $('#miniThumLink').stop().slideDown(150); } // ミニサムネイクローズ関数 function clsMiniThumbnail() { // 非表示 $('#miniThumLink').stop().slideUp(150); // ミニサムネイルを初期化 $('#miniThumLink').css('pointer-events', 'none'); $('#miniThumLink').attr('href', '#'); $('#miniThumbnail').attr('src', ''); }