رفتن به مطلب

مشکل در گذاشتن کد در single.php


پست های پیشنهاد شده

من یه کد دارم که میخوام اون رو توی single.php بزارم. اما وقتی میزارم, کلیه این فایل به هم میریزه و سایت خراب میشه

کد:


<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<title>Colorbox Examples</title>
<style>
body{font:12px/1.2 Verdana, sans-serif; padding:0 10px;}
a:link, a:visited{text-decoration:none; color:#416CE5; border-bottom:1px solid #416CE5;}
h2{font-size:13px; margin:15px 0 0 0;}
</style>
<link rel="stylesheet" href="colorbox.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="../jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
//Examples of how to assign the Colorbox event to elements
$(".inline").colorbox({inline:true, width:"50%"});
$(".callbacks").colorbox({
onOpen:function(){ alert('onOpen: colorbox is about to open'); },
onload:function(){ alert('onload: colorbox has started to load the targeted content'); },
onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
});
$('.non-retina').colorbox({rel:'group5', transition:'none'})
$('.retina').colorbox({rel:'group5', transition:'none', retinaImage:true, retinaUrl:true});

//Example of preserving a Javascript event for inline calls.
$("#click").click(function(){
$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
return false;
});
});
</script>
</head>
<p style="text-align: center;"><a class="inline" href="#zoom"><img src="http://game.balyan.ir/wp-content/themes/movable/images/zoom.png" alt="" /></a> <a class="inline" href="#tv"><img src="http://game.balyan.ir/wp-content/themes/movable/images/tv.png" alt="" /></a> <a class="inline" href="#tablet"><img src="http://game.balyan.ir/wp-content/themes/movable/images/tablet.png" alt="" /></a></p>
<!-- This contains the hidden content for inline calls -->
<div style='display:none'>
<div id='zoom' style='padding:10px; background:#fff;'>
<iframe src="http://balyan.ir/forum" width="640" height="530" frameborder="no" scrolling="no"></iframe>
</div>
<div id='tv' style='padding:10px; background:#fff;'>
<iframe src="http://balyan.ir/" width="640" height="530" frameborder="no" scrolling="no"></iframe>
</div>
<div id='tablet' style='padding:10px; background:#fff;'>
<iframe src="http://game.balyan.ir/" width="640" height="530" frameborder="no" scrolling="no"></iframe>
</div>
</body>
</html>

دمو کد

کد رو چطوری بزارم که این فایل به هم نریزه؟

لینک به ارسال

این بخش کد را در style.css بگذارید


body{font:12px/1.2 Verdana, sans-serif; padding:0 10px;}
a:link, a:visited{text-decoration:none; color:#416CE5; border-bottom:1px solid #416CE5;}
h2{font-size:13px; margin:15px 0 0 0;}

این بخش را در header.php (با تغییری که داده شده)


<link rel="stylesheet" href="<?php bloginfo('template_directory');?>/colorbox.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="<?php bloginfo('template_directory');?>/jquery.colorbox.js"></script>

<script>
$(document).ready(function(){
//Examples of how to assign the Colorbox event to elements
$(".inline").colorbox({inline:true, width:"50%"});
$(".callbacks").colorbox({
onOpen:function(){ alert('onOpen: colorbox is about to open'); },
onload:function(){ alert('onload: colorbox has started to load the targeted content'); },
onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
});
$('.non-retina').colorbox({rel:'group5', transition:'none'})
$('.retina').colorbox({rel:'group5', transition:'none', retinaImage:true, retinaUrl:true});

//Example of preserving a Javascript event for inline calls.
$("#click").click(function(){
$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
return false;
});
});
</script>

این بخش را در single.php


<p style="text-align: center;"><a class="inline" href="#zoom"><img src="http://game.balyan.ir/wp-content/themes/movable/images/zoom.png" alt="" /></a> <a class="inline" href="#tv"><img src="http://game.balyan.ir/wp-content/themes/movable/images/tv.png" alt="" /></a> <a class="inline" href="#tablet"><img src="http://game.balyan.ir/wp-content/themes/movable/images/tablet.png" alt="" /></a></p>
<!-- This contains the hidden content for inline calls -->
<div style='display:none'>
<div id='zoom' style='padding:10px; background:#fff;'>
<iframe src="http://balyan.ir/forum" width="640" height="530" frameborder="no" scrolling="no"></iframe>
</div>
<div id='tv' style='padding:10px; background:#fff;'>
<iframe src="http://balyan.ir/" width="640" height="530" frameborder="no" scrolling="no"></iframe>
</div>
<div id='tablet' style='padding:10px; background:#fff;'>
<iframe src="http://game.balyan.ir/" width="640" height="530" frameborder="no" scrolling="no"></iframe>
</div>

و دو فایل colorbox.css و jquery.colorbox.js را آپلود کنید به روت پوشه ی قالب

  • امتیاز 5
لینک به ارسال

این کد با قالب من سازگار نیست

دنبال یه کد هستم که وقتی روی اون کلیک کنی, یه صفحه (تمام صفحه) باز بشه و یه کد رو فراخوانی کنه و قابلیت بستن اون صفحه با کلیک روی علامت * رو داشته باشه

لینک به ارسال

منظورتون popUp است؟


<a href="#" onclick="window.open(/*url*/'LINK','name','width=400,height=300,left=300,top=100,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');">EXAMPLE</a>

بجای LINK نشانی صفحه را بگذارید و اگر می خواهید اسکریپتی لود شود

اسکریپت را در یک فایل js در پوشه افزونه قرار بدید مثلا بنام script.js و


<a href="#" onclick="example_popup()">EXAMPLE</a>
<script type="text/javascript">
function example_popup() {
var w = window.open('', '', 'width=400,height=400,resizeable,scrollbars');
var x='<script type="text/javascript" src="<?php bloginfo(\'template_directory\');?>/script.js"><\/\script>';
w.document.write(x);
w.document.close(); // needed for chrome and safari
}
</script>

  • امتیاز 2
لینک به ارسال

یه پاپ آپ میخوام که شبیه به کد زیر باز بشه:

http://game.balyan.ir/wp-content/themes/movable/box/example5/index.html

البته میخوام این پنجره تمام صفحه باز بشه

البته میخوام بجای لینک, کد توی اون فراخوانی بشه

لینک به ارسال

لطفا برای ارسال دیدگاه وارد شوید

شما بعد از اینکه وارد حساب کاربری خود شدید می توانید دیدگاهی ارسال کنید



ورود به حساب کاربری
×
×
  • اضافه کردن...