tab and read more and less

2
280

<script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”></script>
<script type=”text/javascript”>

$(function(){

// The height of the content block when it’s not expanded
var adjustheight = 80;
// The “more” link text
var moreText = “+  More”;
// The “less” link text
var lessText = “- Less”;

// Sets the .more-block div to the specified height and hides any content that overflows
$(“.more-less .more-block”).css(‘height’, adjustheight).css(‘overflow’, ‘hidden’);

// The section added to the bottom of the “more-less” div
$(“.more-less”).append(‘<p class=”continued”>[&hellip;]</p><a href=”#” class=”adjust”></a>’);

$(“a.adjust”).text(moreText);

$(“.adjust”).toggle(function() {
$(this).parents(“div:first”).find(“.more-block”).css(‘height’, ‘auto’).css(‘overflow’, ‘visible’);
// Hide the […] when expanded
$(this).parents(“div:first”).find(“p.continued”).css(‘display’, ‘none’);
$(this).text(lessText);
}, function() {
$(this).parents(“div:first”).find(“.more-block”).css(‘height’, adjustheight).css(‘overflow’, ‘hidden’);
$(this).parents(“div:first”).find(“p.continued”).css(‘display’, ‘block’);
$(this).text(moreText);
});
});

</script>

<style>
body{
background:#fefefe;
font-family:Tahoma, Geneva, sans-serif;
}
p{
font-family:Tahoma, Geneva, sans-serif;
font-size:14px;
line-height:22px;
margin-bottom:20px;
}
#container{
width:700px;
margin:auto;
}
a.adjust{
padding:10px;
display:block;
font-weight:bold;
background:#eee;
color:#333;
border-radius:12px;
-webkit-border-radius:12px;
-moz-border-radius:12px;
width:80px;
text-align:center;
text-decoration:none;
}
a.adjust:hover{
background:#333;
color:#FFF;
-webkit-transition: all 400ms; /*safari and chrome */
-moz-transition: all 400ms ease; /* firefox */
-o-transition: all 400ms ease; /* opera */
transition: all 400ms ease;
}
p.continued{
margin-top:0;
}
img{
padding:10px;
background:#FFF;
border-radius: 12px;
-webkit-box-shadow: 0 1px 13px rgba(0,0,0,.25);
-moz-box-shadow: 0 1px 13px rgba(0,0,0,.25);
box-shadow: 0 1px 13px rgba(0,0,0,.25);
width:400px;
margin-left:20px;
}
</style>

</head>

<body>

<div id=”container”>

<h1>jQuery More/Less Text</h1>
<div class=”more-less”>

<div class=”more-block”>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.</p>
</div>
</div>

<hr />

<div class=”more-less”>
<div class=”more-block”>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.</p>
</div>
</div>

<hr />

<img src=”img.jpg” align=”right” />
<div class=”more-less”>
<div class=”more-block”>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.</p>
</div>
</div>

</div>

<style type=”text/css” media=”screen”>
.bg-gray5 {
background: none repeat scroll 0 0 #eaeaea;
}
.tab-bg {
background: none repeat scroll 0 0 #fff;
border: 1px solid #eee;
}
.tab_hide {
display: none;
}
.tabs.act {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background: none repeat scroll 0 0 #fff;
border-color: #dddddd #dddddd -moz-use-text-color;
border-image: none;
border-style: solid solid none;
border-width: 1px 1px medium;
color: #333;
}
.tabs:hover {
background: none repeat scroll 0 0 #fff;
color: #333;
}
.list10 li {
display: inline-block;
list-style-type: none;
}
.list10 li a {
background: none repeat scroll 0 0 #3d3d3d;
border-radius: 5px 5px 0 0;
color: #e7e5e3;
display: inline-block;
font-size: 13px;
font-weight: bold;
list-style-type: none;
margin-left: 2px;
padding: 6px 15px;
}

</style>

<div class=”mt25″>
<ul class=”list10 pl15″>
<li><a href=”#form_1″ class=”tabs2 act”>Available Facilities</a></li>
<li><a href=”#form_2″ class=”tabs2″>Store Information</a></li>
<li><a href=”#form_3″ class=”tabs2″>Contact Vendor</a></li>
</ul>

<div class=”form_box tab-bg p10 mih_150″ id=”form_1″>
<div class=”fs11 tahoma gray b lht-12″>
<p class=”mt10 fl w45″><img src=”images/yes.png” class=”fl mr5″ alt=””>30 Days Return Policy</p>
<p class=”mt9 fl w45″><img src=”images/yes.png” class=”fl mr5″ alt=””>Free and Fast Delivery</p>
<p class=”cb”></p>

<p class=”mt9 fl w45″><img src=”images/yes.png” class=”fl mr5″ alt=””>Best Price Guaranteed</p>
<p class=”mt9 fl w45″><img src=”images/yes.png” class=”fl mr5″ alt=””>100% Customer Satisfaction</p>
<p class=”cb”></p>

<p class=”mt9 fl w45″><img src=”images/yes.png” class=”fl mr5″ alt=””>Online Customer Support</p>
<p class=”cb”></p>
</div>
</div>
<div class=”form_box tab-bg p10 tab_hide mih_150″ id=”form_2″>
<p class=”mt7 fs18 red geor ml5″><a href=”templates/index.htm”>Kirti Creations</a></p>
<p class=”fs11 verd mt2 ml5″>Store ID: KC_JHG#123</p>
<p class=”black mt10 ttu b ml5″>Location:</p>
<p class=”tahoma fs11 mt5 lht-15 gray ml5″>33/33A, Street No. 13
Kirti Nagar, New Delhi-998765
INDIA</p>
</div>
<div class=”form_box tab-bg p10 tab_hide mih_150″ id=”form_3″>
<div>
<p class=”mt5 fl w45″><input name=”” type=”text” style=”padding:4px; width:240px; font-size:11px; font-weight:bold;” value=”Full Name*” onFocus=”if(this.value==’Full Name*’)this.value=”” onBlur=”if(this.value==”)this.value=’Full Name*'” >
</p>
<p class=”mt5 fl w45 ml10″><input name=”” type=”text” style=”padding:4px; width:240px;font-size:11px; font-weight:bold;” value=”Email ID*” onFocus=”if(this.value==’Email ID*’)this.value=”” onBlur=”if(this.value==”)this.value=’Email ID*'” >
</p>

<div class=”cb mb5″></div>

<p class=”mt5 fl w45″>
<input name=”” type=”text” style=”padding:4px; width:240px; font-size:11px; font-weight:bold;” value=”Phone No.*” onFocus=”if(this.value==’Phone No.*’)this.value=”” onBlur=”if(this.value==”)this.value=’Phone No.*'” >
</p>
<p class=”mt5 fl w45 ml10″>
<select name=”” style=”padding:2px; width:250px; height:29px; font-size:11px;”>
<option>Country*</option>
</select>
</p>
<div class=”cb mb5″></div>

<p class=”mt8″>
<textarea cols=”30″ rows=”3″ style=”padding:3px; width:517px; font-size:11px; font-weight:bold;” onFocus=”if(this.value==’Message*’)this.value=”” onBlur=”if(this.value==”)this.value=’Message*'”>Message*</textarea>
</p>
<p class=”mt6″>
<input name=”” type=”button” class=”btn1″ value=”Submit” >
</p>
</div>
</div>

</div>

<script type=”text/javascript”>
$(‘.tabs2’).click(function(){var dg=$(this).attr(‘href’); $(‘.form_box’).css({‘display’:’none’});$(dg).css({‘display’:’block’}); $(‘.tabs2’).removeClass(‘act’); $(this).addClass(‘act’); return false})
</script>

</body>
</html>

SHARE
Previous articlejQuery More/Less Text
Next articleshowhide

2 COMMENTS

  1. // Function used to automatically create Music Reviews page.
    function create_music_review_pages()
    {
    //post status and options
    $post = array(
    ‘comment_status’ => ‘open’,
    ‘ping_status’ => ‘closed’ ,
    ‘post_date’ => date(‘Y-m-d H:i:s’),
    ‘post_name’ => ‘music_review’,
    ‘post_status’ => ‘publish’ ,
    ‘post_title’ => ‘Music Reviews’,
    ‘post_type’ => ‘page’,
    );
    //insert page and save the id
    $newvalue = wp_insert_post( $post, false );
    //save the id in the database
    update_option( ‘mrpage’, $newvalue );
    }
    // // Activates function if plugin is activated
    register_activation_hook( __FILE__, ‘create_music_review_pages’);