شرحي List-Grid برمجه طول ومربعات في اي اضافه وكمثال البلوجر مميز لجوال

مشاهدات الان

 انا افضل هذا Grid

المهم الشرح والمصدر

https://www.w3schools.com/howto/howto_js_list_grid_view.asp

راح تجد ثلاث ملفات

1- HTML

2- CSS

3- JavaScript

والمهم في الشرح اذا حبيت الحفظ لكود من هذا الرابط

https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css

ومن غير وجوده اذا مو شغال الرابط يخرب لتنبيه فقط


الان بندأ  بالشرح :


4- الكود كله هنا

https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_list_grid_view

لوضعه في صفحات الويب مثلا فقط تعدل ما تحب


5- وضع الاكواد بالبلوجر


البحث عن

</head>

فوقه

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">


البحث عن

]]></b:skin>

فوقه

/* Create two equal columns that floats next to each other */

.column {

  float: left;

  width: 50%;

  padding: 10px;

}


/* Clear floats after the columns */

.row:after {

  content: "";

  display: table;

  clear: both;

}


الاضافه لـ إعداد اللغة HTML/JavaScript

// Get the elements with class="column"

var elements = document.getElementsByClassName("column");


// Declare a loop variable

var i;


// List View

function listView() {

  for (i = 0; i < elements.length; i++) {

    elements[i].style.width = "100%";

  }

}


// Grid View

function gridView() {

  for (i = 0; i < elements.length; i++) {

    elements[i].style.width = "50%";

  }

}


او اتبع التالي البحث عن

</head>

فوقه

<b:if cond='data:blog.pageType == &quot;index&quot;'>

<script language='javascript'  src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js'  type='text/javascript'/>

<script type='text/javascript'>//<![CDATA[


$(document).ready(function() {


    var width         = 200;

    var height        = 170;

    var placeholder    = 'http://3.bp.blogspot.com/-7Ie-cUwxWB4/U2KIRWgvpNI/AAAAAAAAIfU/Mj6qpg5S2fk/s1600/no-thumb.png';

    var margins     = "0px 0px 10px 10px";

    var fitThumb                 = 1;

    var titleTopPadding            = 5;

    var titleBottomPadding        = 8;

    var titleLeftRightPadding    = 5;    


    var titlePadding = titleTopPadding + 'px ' + titleLeftRightPadding +  'px ' + titleBottomPadding + 'px ' + titleLeftRightPadding + 'px';

    $('.post-body').each(function(n, wrapper){

        var wrapper         = $(wrapper);

        var image         = $(wrapper).find('img').first();

        var link         = wrapper.parent().find('h3 a');

        var linkURL         = link.attr('href');

        var linkTitle        = link.text();


        $(link).remove();

        wrapper.empty();


        if (image.attr('src')) {

            var thumbHeight = image.attr('height');

            var thumbWidth = image.attr('width');    

            var thumbParent = $(image).parent();


            wrapper.append(thumbParent);


            if (fitThumb) {

                image.attr({src : image.attr('src').replace(/s\B\d{3,4}/,'s' + width + '-c')});

                image.attr('width',width).attr('height',height);

            } else {

                image.attr({src : image.attr('src').replace(/s\B\d{3,4}/,'s' + width)});

                image.attr('width',width);

                var changeHeight = (thumbHeight/thumbWidth * width).toFixed(0);

                image.attr('height',changeHeight);

            }

            

        } else {

            var image = $('<img>').attr('src',placeholder).attr('height',height).attr('width',width);

            var thumbParent = $('<a>').append(image).appendTo(wrapper);

        }


         thumbParent.attr('href',linkURL).css('clear','none').css('margin-left','0').css('margin-right','0').addClass('postThumbnail');

        

        var thumbTitle =  $('<div>').prepend(linkTitle).css('padding',titlePadding).css('opacity','0.9').css('filter','alpha(opacity=0.9)').css('width',width).appendTo(thumbParent);   

        var ptitleHeight = thumbTitle.height();

        var summary = parseInt(ptitleHeight) + parseInt(titleTopPadding) + parseInt(titleBottomPadding);

        thumbTitle.css('margin-top','-'+summary+'px');             wrapper.css('float','left').css('height',height).css('width',width).css('margin',margins).css('overflow','hidden');

    });

    $('#blog-pager').css('clear','both');

});


function hideLightbox() {

    var images = document.getElementsByTagName('img');

    for (var i = 0 ; i < images.length ; ++i) {

        images[i].onmouseover=function() {

            var html = this.parentNode.innerHTML;

            this.parentNode.innerHTML = html;

            this.onmouseover = null;

        };

    }

}


if (window.addEventListener) {

    window.addEventListener('load',hideLightbox,undefined);

} else {

    window.attachEvent('onload',hideLightbox);

}

//]]></script>

<style>

.post {

border-bottom: 0 dotted #E6E6E6;

margin-bottom: 0;

padding-bottom: 0;

}

h2,.post-footer {

display:none;

}

a.postThumbnail div {

text-decoration: none; color: #fff;

font-size: 12px;

font-weight: bold;

text-transform: capitalize;

background: rgb(125,126,125); /* Old browsers */

background: -moz-linear-gradient(top,  rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%);

background:  -webkit-gradient(linear, left top, left bottom,  color-stop(0%,rgba(125,126,125,1)), color-stop(100%,rgba(14,14,14,1)));  /* Chrome,Safari4+ */

background: -webkit-linear-gradient(top,  rgba(125,126,125,1) 0%,rgba(14,14,14,1) 100%);

background: -o-linear-gradient(top,  rgba(125,126,125,1) 0%,rgba(14,14,14,1) 100%); 

background: -ms-linear-gradient(top,  rgba(125,126,125,1) 0%,rgba(14,14,14,1) 100%); 

background: linear-gradient(to bottom,  rgba(125,126,125,1) 0%,rgba(14,14,14,1) 100%); 

filter:  progid:DXImageTransform.Microsoft.gradient(  startColorstr=&#39;#7d7e7d&#39;,  endColorstr=&#39;#0e0e0e&#39;,GradientType=0 ); 

a.postThumbnail:hover div {

display: block;

}

.post-body img {

background-color: transparent;

border: 1px solid transparent;

padding: 0px;

-webkit-border-radius: 12px; 

-moz-border-radius: 12px; 

border-radius: 12px; 

opacity: 1;

transition: opacity .25s ease-in-out;

-moz-transition: opacity .25s ease-in-out;

-webkit-transition: opacity .25s ease-in-out;

}

.post-body img:hover {

-ms-filter: &quot;progid:DXImageTransform.Microsoft.Alpha(Opacity=70)&quot;;

filter: alpha(opacity=70);

-moz-opacity: 0.7;

-khtml-opacity: 0.7;

opacity: 0.7;

}

</style>

</b:if>

تكبير الصوره او تصغيرها عندك 200- 170

وهذا تطبيق جربه :

البحث عن

</head>

فوقه

<!-- Auto Auto Image Thumbnail & ReadMore Link By EXEIdeas Script Start -->

<b:if cond='data:blog.pageType != &quot;item&quot;'>

<b:if cond='data:blog.pageType != &quot;static_page&quot;'>

<style type='text/css'>

.date-outer .post-outer{width:46%;float:left;margin:20px 0px 0px 20px;height:490px;}

.date-outer .post-outer .post-body {font-family:Helvetica, Arial;font-size:13px;height:432px;}

.date-outer .post-header {margin:0px;}

.date-outer .post-outer h2.exe_post_TITLE {margin:0px;font-size:24px;font-family:fantasy;font-weight:normal;}

.date-outer .post-outer h2.exe_post_TITLE a:hover{text-decoration:underline;}

.date-outer .post-outer img.exe_post_IMG {width:240px;height:240px;margin-bottom:4px;}

.date-outer .post-outer .exe_post_Desc  {font-size: 12px;padding: 10px;display: block;}

.date-outer .post-outer .post-footer {text-align:left;display:block;padding:10px;font-size:11px;}

#exe_readmore {background:#424242;color:#fff;padding:5px;text-decoration:none;margin-top:4px;display:block;width:90px;float:right;}

.post-title, .post-author, .post-timestamp, .post-icons, .post-labels, .post-location, .author-profile, .date-header, .jump-link {display:none;}

</style>

<script type='text/javascript'>

//<![CDATA[


var noImgSum = 800;

var imgSum =180;

var _0xa07b=["x3C","x69x6Ex64x65x78x4Fx66","x73x70x6Cx69x74","x6Cx65x6Ex67x74x68","x3E","x73x75x62x73x74x72x69x6Ex67","","x6Ax6Fx69x6E","x63x68x61x72x41x74","x20","x2Ex2Ex2E","x67x65x74x45x6Cx65x6Dx65x6Ex74x42x79x49x64","x69x6Dx67","x67x65x74x45x6Cx65x6Dx65x6Ex74x73x42x79x54x61x67x4Ex61x6Dx65","x3Cx64x69x76x20x63x6Cx61x73x73x3Dx22x65x78x65x5Fx70x6Fx73x74x5Fx44x49x56x22x3Ex3Cx69x6Dx67x20x63x6Cx61x73x73x3Dx22x65x78x65x5Fx70x6Fx73x74x5Fx49x4Dx47x22x20x73x72x63x3Dx22","x73x72x63","x22x20x2Fx3E","x3Cx68x32x20x63x6Cx61x73x73x3Dx22x65x78x65x5Fx70x6Fx73x74x5Fx54x49x54x4Cx45x22x3Ex3Cx61x20x68x72x65x66x3Dx22","x22x3E","x3Cx2Fx61x3Ex3Cx2Fx68x32x3Ex3Cx73x70x61x6Ex20x63x6Cx61x73x73x3Dx22x65x78x65x5Fx70x6Fx73x74x5Fx44x65x73x63x22x3E","x69x6Ex6Ex65x72x48x54x4Dx4C","x3Cx2Fx73x70x61x6Ex3Ex3Cx2Fx64x69x76x3E"];function removeHtmlTag(_0xe2dax2,_0xe2dax3){if(_0xe2dax2[_0xa07b[1]](_0xa07b[0])!=-1){var _0xe2dax4=_0xe2dax2[_0xa07b[2]](_0xa07b[0]);for(var _0xe2dax5=0;_0xe2dax5<_0xe2dax4[_0xa07b[3]];_0xe2dax5++){if(_0xe2dax4[_0xe2dax5][_0xa07b[1]](_0xa07b[4])!=-1){_0xe2dax4[_0xe2dax5]=_0xe2dax4[_0xe2dax5][_0xa07b[5]](_0xe2dax4[_0xe2dax5][_0xa07b[1]](_0xa07b[4])+1,_0xe2dax4[_0xe2dax5][_0xa07b[3]]);} ;} ;_0xe2dax2=_0xe2dax4[_0xa07b[7]](_0xa07b[6]);} ;_0xe2dax3=(_0xe2dax3<_0xe2dax2[_0xa07b[3]]-1)?_0xe2dax3:_0xe2dax2[_0xa07b[3]]-2;while(_0xe2dax2[_0xa07b[8]](_0xe2dax3-1)!=_0xa07b[9]&&_0xe2dax2[_0xa07b[1]](_0xa07b[9],_0xe2dax3)!=-1){_0xe2dax3++;} ;_0xe2dax2=_0xe2dax2[_0xa07b[5]](0,_0xe2dax3-1);return _0xe2dax2+_0xa07b[10];} ;function EXEautoReadMore(_0xe2dax7,_0xe2dax8,_0xe2dax9){var _0xe2daxa=document[_0xa07b[11]](_0xe2dax7);var _0xe2daxb=_0xa07b[6];var _0xe2daxc=_0xe2daxa[_0xa07b[13]](_0xa07b[12]);var _0xe2daxd=noImgSum;if(_0xe2daxc[_0xa07b[3]]>=1){_0xe2daxb=_0xa07b[14]+_0xe2daxc[0][_0xa07b[15]]+_0xa07b[16];_0xe2daxd=imgSum;} ;var _0xe2daxe=_0xe2daxb+_0xa07b[17]+_0xe2dax9+_0xa07b[18]+_0xe2dax8+_0xa07b[19]+removeHtmlTag(_0xe2daxa[_0xa07b[20]],_0xe2daxd)+_0xa07b[21];_0xe2daxa[_0xa07b[20]]=_0xe2daxe;} ;

//]]&gt;

</script>

</b:if>

</b:if>

<!-- Auto Auto Image Thumbnail & ReadMore Link By EXEIdeas Script End -->

البحث عن

<data:post.body/>

ستجد ثلاثه او اثنين هو الاخير استبدله

<!-- Auto Auto Image Thumbnail & ReadMore Link By EXEIdeas Script Start -->

<b:if cond='data:blog.pageType == &quot;item&quot;'>

<data:post.body/>

<b:else/>

<b:if cond='data:blog.pageType == &quot;static_page&quot;'>

<data:post.body/>

<b:else/>

<div expr:id='&quot;summary&quot; + data:post.id'><data:post.body/></div>

<script type='text/javascript'> EXEautoReadMore(&quot;summary<data:post.id/>&quot;, &quot;<data:post.title/>&quot;, &quot;<data:post.url/>&quot; );

</script>

<a expr:href='data:post.url' id='exe_readmore'>اقراء المزيـد...</a>

</b:if>

</b:if>

<!-- Auto Auto Image Thumbnail & ReadMore Link By EXEIdeas Script End -->

والبحث عن

<b:includable id='nextprev'>

فوقه

<div style='clear:both;'/>

وهذا الثاني جربه :

البحث عن

</head>

فوقه

<script type='text/javascript'>

function list_view(){

if(document.getElementsByClassName(&quot;post&quot;)) {elementArray = document.getElementsByClassName(&quot;post&quot;); while (elementArray.length) {elementArray[0].className = &quot;post-grid-view&quot;;}}

if(document.getElementsByClassName(&quot;post-title&quot;)) {elementArray = document.getElementsByClassName(&quot;post-title&quot;); while (elementArray.length) {elementArray[0].className = &quot;post-title-grid&quot;;}}

}

function grid_view(){

if(document.getElementsByClassName(&quot;post-grid-view&quot;)) {elementArray = document.getElementsByClassName(&quot;post-grid-view&quot;); while (elementArray.length) {elementArray[0].className = &quot;post&quot;;}}

if(document.getElementsByClassName(&quot;post-title-grid&quot;)) {elementArray = document.getElementsByClassName(&quot;post-title-grid&quot;); while (elementArray.length) {elementArray[0].className = &quot;post-title&quot;;}}

}

</script>

 <script type='text/javascript'>

posts_no_thumb_sum = 100;

posts_thumb_sum = 350;

</script>


<script type='text/javascript'>

//<![CDATA[

function removeHtmlTag(strx,chop){

if(strx.indexOf("<")!=-1)

{

var s = strx.split("<");

for(var i=0;i<s.length;i++){

if(s[i].indexOf(">")!=-1){

s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);

}

}

strx = s.join("");

}

chop = (chop < strx.length-1) ? chop : strx.length-2;

while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;

strx = strx.substring(0,chop-1);

return strx+'...';

}

function createSummaryAndThumb(pID, pURL, pTITLE){

var div = document.getElementById(pID);

var imgtag = "";

var img = div.getElementsByTagName("img");

var summ = posts_no_thumb_sum;

if(img.length>=1) {

imgtag = '<span class="posts-thumb" style="float:left; margin-right: 10px;"><a href="'+ pURL +'"><img src="'+img[0].src+'" /></a></span>';

summ = posts_thumb_sum;

}


else {

imgtag = '<span class="posts-thumb" style="float:left; margin-right: 10px;"><a href="'+ pURL +'" title="'+ pTITLE+'"><img src="http://2.bp.blogspot.com/-Gbn3dT1R9Yo/VPXSJ8lih_I/AAAAAAAALDQ/24wFWdfFvu4/s1600/sorry-image-not-available.png" style="margin-top: -30px;" /></a></span>';

summ = posts_thumb_sum;

}


var summary = imgtag + '<a href="'+ pURL +'"><div class="post-summary-text">' + removeHtmlTag(div.innerHTML,summ) + '</div></a>';

div.innerHTML = summary;

}

//]]>

</script>


<b:if cond='data:blog.pageType != &quot;static_page&quot;'>

<b:if cond='data:blog.pageType!= &quot;item&quot;'>

<style>

#list-view-button {font-family: Verdana; text-align:left;cursor:pointer;font-size: 14px;border-bottom: 5px solid #eaeaea;text-decoration: none;}

#list-view-button a{text-decoration: none; color: #666;}

.grid-view-button {background-color:#efefef;color:#666;padding:5px 10px;border-radius: 5px;font-size: 12px;}

.list-view-button {background-color:#efefef;color:#000;padding:5px 10px;border-radius: 5px;font-size: 12px;}

.post-grid-view {width:100%;height:250px;overflow: hidden;float:left;margin:0px 0px 20px !important;position:relative;display: block; -webkit-transition:all 0.5s ease 0s; -moz-transition:all 0.5s ease 0s; -o-transition:all 0.5s ease 0s; transition:all 0.5s ease 0s; }

.post-grid-view .posts-thumb {width:40% !important;height:250px !important;float:left;margin:0px;position:relative;border-top: 0px solid transparent !important;overflow: hidden;}

.post-grid-view .post-header {display: none;}

.post-grid-view .post-body img {min-width: 300px !important; min-height: 250px !important;display:block;width:100%!important;height:auto!important;max-width:800px!important;max-height:400px!important;border:none;outline:none;position:relative;margin: 0px;padding:0;}

.post-grid-view .post-summary-text {opacity: 1; background: none; width: 58%;font-size: 120% !important;clear: none !important; display: inline-block !important; padding: 80px 0px !important; color: #666 !important; text-shadow: none !important; float: right !important; text-align: left; position: relative !important; font-family: &#39;Open Sans Condensed&#39;, sans-serif;}

.post-grid-view .post-body {height: 250px;background:#f5f5f5; box-shadow: none !important;}

.post-title-grid a { font-size:170%;color: #777;font-family: &#39;Open Sans Condensed&#39;, sans-serif;}

.post-title-grid { position: absolute; left: 42%; top: 5%; z-index: 1;}

.post-grid-view .post-footer {left: 41%; display:block;position: absolute; bottom: 2%;font-size: 120%; background: transparent !important; border: 0px solid transparent !important;font-family: &#39;Open Sans Condensed&#39;, sans-serif;}

.post-grid-view .post-footer a{color: #128EC9;}

.post-grid-view a.comment-bubble {display: none;}

.main-inner .column-center-inner .section {margin: 0px !important;}

.post { -webkit-transition:all 0.5s ease 0s; -moz-transition:all 0.5s ease 0s; -o-transition:all 0.5s ease 0s; transition:all 0.5s ease 0s;}


#blog-pager {clear:both;}

.post {height:auto;width:32.2%;display:inline-block;text-decoration:none;float:left;margin:0 1% 1% 0%;overflow: hidden;padding:0!important;}

.date-header {display: none;}

h3.post-title a {font-size:90%;font-family: &#39;Open Sans Condensed&#39;, sans-serif;text-transform:uppercase;color:#fff;text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);font-weight: bold;}

h3.post-title {text-align: center; position:absolute;top:0;width:100%;overflow:hidden;margin:0px !important;padding-top: 30%; background-color: rgba(50, 126, 213, 0.8);transform: scale(1);opacity: 0;z-index: 10;height: 100%;transition: all 300ms ease-out 0s;}

h3.post-title:hover {opacity: 1;}

.posts-thumb {width:100%!important;height:200px!important;overflow:hidden;clear:both;}

.post-body {border-radius:2px;box-shadow:0 5px 4px 1px rgba(0,0,0,0.1);position:relative;overflow: hidden;}

.post-body a {text-decoration: none;}

.post-body img {display:block;width:100%!important;height:auto!important;max-width:800px!important;max-height:400px!important;min-width:200px!important;min-height:200px!important;border:none;outline:none;position:relative;margin: 0px;padding:0;}

.post-summary-text {display: none;}

a.comment-bubble {color:#fff;text-decoration:none;font-size:100%;width: 100%;text-align: center;position:absolute;top:175px;left: 0px;text-shadow:1px 2px 1px #333;font-family: &#39;Pacifico&#39;, cursive;z-index: 122;}

a.comment-bubble:before { content: &quot;Comments: &quot; url(http://4.bp.blogspot.com/-t1i_svebif4/VPMpZqPrKzI/AAAAAAAALAg/TRJ2Un238Gs/s1600/heart-active.png);}

.post-header,.post-footer {display:none;}

</style></b:if></b:if>

<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'/>

<link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'/>


البحث عن

    <b:section class='main' id='main' showaddelement='no'>

او هذ

    <b:section class='main' id='main' showaddelement='yes'>

اضف هذا فوقه

    <b:if cond='data:blog.pageType != &quot;static_page&quot;'>

    <b:if cond='data:blog.pageType!= &quot;item&quot;'>

    <div id='list-view-button'><a class='grid-view-button' onclick='grid_view()'><img src='http://1.bp.blogspot.com/-vjVOXJyXcC4/VP9A7twG8mI/AAAAAAAALJ8/YW0yxhvxP7A/s1600/search-grid-icon.png' style='margin: -8px 1px -3px -6px;width: 16px;'/> Grid View</a> <a class='list-view-button' onclick='list_view()'><img src='http://4.bp.blogspot.com/-SrQiXEhgVmA/VP9BUnr3KkI/AAAAAAAALKE/EwVFym9YxoA/s1600/icon-list-view.png' style='margin: -8px 1px -3px -6px;width: 16px;'/> List View</a></div>

    </b:if></b:if>

والبحث عن

    <data:post.body/>

اذا وجده اكثر من واحد عليك بالثاني والثالث فقط استبدال

     <b:if cond='data:blog.pageType != &quot;static_page&quot;'>

        <b:if cond='data:blog.pageType != &quot;item&quot;'>

            <div expr:id='&quot;summary&quot; + data:post.id'>

                <data:post.body/>

            </div>

            <script type='text/javascript'>createSummaryAndThumb(&quot;summary<data:post.id/>&quot;,&quot;<data:post.url/>&quot;);</script>

            <b:if cond='data:post.allowComments'>

                <a class='comment-bubble' expr:href='data:post.addCommentUrl' expr:onclick='data:post.addCommentOnclick'>

                    <data:post.numComments/>

                </a>

            </b:if>

        </b:if>

    </b:if>

    <b:if cond='data:blog.pageType == &quot;item&quot;'>

        <data:post.body/>

    </b:if>

    <b:if cond='data:blog.pageType == &quot;static_page&quot;'>

        <data:post.body/>

    </b:if>

وسلامتكم

شرحي List-Grid برمجه طول ومربعات في اي اضافه وكمثال البلوجر مميز لجوال شرحي  List-Grid برمجه طول ومربعات في اي اضافه وكمثال البلوجر مميز لجوال Reviewed by صفحات هايف on ديسمبر 30, 2023 Rating: 5

ليست هناك تعليقات:

يتم التشغيل بواسطة Blogger.